Judge rules to keep dangerous rail crossings closed