Oh yeah, once you're out of the map weird shit starts to happen. Not really a bug since the player's never supposed to encounter it.
In this case, it's because the train is coded to pull the player along with it. When it finishes passing under Flynn's alley, it teleports back to the start point, which happens to be inside a wall. It takes the player with it and they get stuck in the wall.