The fly's momentum (mass and velocity) certainly do affect the train, but not on any real measurable scale, so you could count it as negligible for the sake of any other problem, but does exist (since momentum can't be destroyed). The fact that the affect does exist, though, is proof enough that the fly decelerates to 0 after impact.