I was always under the impression that the locomotive had some sort of switch or lever that was designed to make sure someone was on board before it could roll off.
Thats my recollection. I had a friend whose dad was an engineer for SP years ago. He took us on a train a couple of times and showed us all the gauges and levers and stuff. But its been a long time so Im probably not remembering something.
Yeah. It's called a "Deadman's Pedal". If it isn't being stepped on, the train is supposed to stop.
Apparently they don't always work.