reorganize FileSave to use a temp file