The answer depends on the traffic light signal. A red signal at a railroad crossing, including a flashing one, bans entering the crossing, whether or not there is a gate (the question's “barrier”) and whatever position it is in. A raised gate does not lift this ban, so the bus driver must stop before the crossing