on the newer maya like 2013.5 there is functionality to not hang on render window, because of that, the script just hit next frame , next frame, next frame, and then just render the last frame !