This cleans up a previous fix to #630 to use a better temp/rename
scheme thats less likely to have bad side effects.
The test for the previous issue still passes these cases, and we
will be less liekly to find a case where the file doesnt exist
or corrpted backup files.