Does the train Engineer have a switch in the locomotive to turn off the crossing lights?
There’s no switch inside the cab to turn crossing lights on and off. What you likely saw was something called a “timing circuit”. Most crossings are timed so the warnings are active for at least 20 seconds before the train occupies it. Some crossings where the trains are likely to stop short of it, have these timing circuits, so if the train does not pass a second point on the rail leading to the crossing by a certain point, the crossing “times out”, the lights go out, and the gates are raised. There are also crossings which can be turned off by way of radio, but there’s not that many around. The engineer puts his radio to a certain channel, then dials a certain tone (radios have number pads like a phone, you can “dial” various numbers like you would on a phone), along with a number unique to that crossing, and something in the signal hut responds to the tone.