It is for static electricity, you see it at cars sometimes too.
It's caused by friction on the wheels with the track.
And with that flap the static electricity on the train is passed to the track.
Otherwise you get a shock if you touch the train, like you experience on a plastic slide.
But the next question is why isn't it on every train then?
Coaster Rider.