If an approaching train is near enough or going fast enough to be a danger, you must:

You should look and listen for trains before crossing any railroad tracks. If an approaching train is near enough or going fast enough to be a danger, you cannot go across the tracks. This is true even if they have no signals or the signals are not working.
DMV Writen Test