In the end of Back to the Future 3, Marty and Jennifer check the wreckage site of the DeLorean when the railroad level crossing suddenly activates and lowers its barriers without any trains nearby. The Doc then appears in his time locomotive machine, shares words, time-travels with his family (not to mention his weird kids, one of whom needs to learn some manners) and thus ends the utterly brilliant saga.
So the question: How could the level crossing have activated if there wasn't a train present?
(pun intended)
I am looking for an in-universe answer please as I doubt anyone would have predicted a 19th Century locomotive appearing out of nowhere at that precise time and location.