Fix accidental redefinition of variable
This can lead to overwriting existing incrementally saved
files instead of trying to find a new file name that doesn't
conflict with existing files.
(cherry picked from commit def8c4f83331427e0430e3d525b70e367c6189ee)