Is this state file truly temporary, or is it supposed to be long-lived?  While nothing currently cleans up the temp directory, it could in theory be emptied at any time, so this should probably go somewhere else I'm guessing (maybe make a new directory if no current directory is appropriate).