Emma was already inside the train, but near a window. She cheered the DA and Harry Potter on, not realizing that being near a window during a battle was probably a bad idea. Luckily, stray spells didn't break any windows on the train, but it was still thrilling and VERY SCARY to watch.