Always stop before crossing railroad tracks when:

Expect a train on any track, at any time, traveling in either direction. If you need to stop after crossing the tracks, wait until you can completely cross the tracks before proceeding. Make sure your vehicle clears the tracks before you stop.
DMV Writen Test Logo