I've had this happen a few times and I still do not know why, even though I have reached out to the help desk. Most of the time it's just a minute or so after I've unlocked or undocked one of the old Gen e-bikes. When I look back at the app it shows my ride is no longer in progress even though I'm very obviously riding the bike. It usually takes a couple tries of actually inserting the cable to end the ride correctly, and then trying to unlock it again before the ride stays in progress. One time I was just across the street from a dock, waiting for the light and the ride ended. I had to go through the process of locking and unlocking multiple times to get the ride to "stick." Then I had to go to another station, because I was too close to the one I wanted to go to and it probably wouldn't have counted.
Similarly, I had 3 scooters fail to recognize the ride ended at a station - it was all the same day, so I assumed there was just something going on with the system. However, it happened again about 5 days later on a new Gen e-bike. This all happened over a month ago and I still am waiting on an answer from the help desk.
The only advice I have is to take pictures and/or video to prove what your saying actually happened, and don't trust that the person helping you can access the picture(s) you might have taken in the app to report an issue or end a ride - in my experience, they don't have access to that, which seems counter intuitive, but it's not my system to run.