A scenario such as the one depicted in Denzel's movie is HIGHLY unlikely, but it sure was a good movie, wasn't it?
It would take a series of prohibited actions to be taken by railroad personnel combined with deliberate overriding of systems put into place to prevent such a thing. You must remember that for every system that is put in place to make something "impossible" to do, there are people out there who have managed to defeat them.
Railroad locomotives have what are called "deadman" switches in them. They take the form of pedals on the floor that the engneer holds down with his foot, or they are in the seat and close a circuit only when someone is sitting in that seat. They must be held down for the train to move forward at anything above an idle.
Railroad locomotives are NEVER supposed to be left unattended in the manner shown in the movie. Any engineer who left a locomotive improperly secured and locked down would be fired, no question. No second chances, no demotion, no break. If he hurt or killed someone or damaged property, there would not be a sling big enough to hold his backside. Remember the dope-smoking crew that pulled a freight train through a red switch onto the main line and were hit by the Amtrak train in the Baltimore, MD area some 20 years ago? Those guys went to Federal Prison.
Current railroad operations are so computerized that a locomotive can literally be controlled remotely by a computer operator. They control switches, train speed, routes and almost everything else. Were it me, I would not worry about trains running up and down the nation's tracks, unmanned, loaded with toxic materials. You stand a better chance of being killed by a stampeding bull or a bolt of lightning.
I do know how they could have stopped Denzel's train without doing any real damage. Instead of having the snipers trying to shoot out a small switch box, they should have had multiple snipers shoot the fuel tank so full of holes that all of the fuel would drain out and the diesel engine would have stopped because of fuel starvation. The helicopter could have done the same thing.
You want to see another good (funny) movie about a runaway train, watch "The Silver Streak" with Richard Pryor. It will make you laugh!!!