Which is why ATO (automatic train operation) is most often found in subways where the platforms can be equipped with gates to keep passengers out until a train has stopped safely. Suicide by train and level crossings are a nightmare in risk management for railway safety, hence also (new) high speed tracks are usually planned without any intersections with roads or paths, at respective additional costs.
Some lines on the London Underground do use ATO without platform barriers. The driver closes the doors, checks that the platform is clear, then starts the train. ATO takes over until the next station, where the driver watches to make sure there's nobody too close to the edge, ready to slam on the emergency brake.