Use a tmp file when saving state and resume files