If you stop to late and get stuck between the gates in a level crossing you should proceed straight ahead, through the gates – they are designed to give way.
If you damage or destroy the gates in a level crossing you must report this to Trafikverket.