Merge pull request #4296 from RisingFog/fix_frame_dump Fix frame dumps on file close in certain situations