Should probably add that my concern with the global file, is if a command forks, or isn't killed, it might keep hold of the file descriptor, and then end up in pickle, hence creating new files for every execution.