That's completely a SA-MP thingy. I have tried it before, but there maybe is a way to avoid being stuck in this running anim and taking damage? For me sometimes it happens and sometimes the fire goes out.
Also there is no "fire duration" in the script, this is a GTA San Andreas thing when you are caught on fire, sometimes you can receive fire damage without even seeing that you are in your screen.
But I'm still not 100% sure if this can not be fixed, I will see what I can find and also a reply from Mike (since he knows better) should be a quick answer to this.