I wouldn't be looking at the code, I would be looking at the model itself for what's wrong with the animation. For example, you said the animation looks fine in 3ds max, but what about in Ultimate Unwrap?
That said, you could probably use ExtractAnimSeq to trim off the last few frames (ie. the pause in the animation.)
That said, you could probably use ExtractAnimSeq to trim off the last few frames (ie. the pause in the animation.)