Bet he'll think twice about a selfie next time he's near a train!