Close safeFile before Renaming
Renaming with the handle open causes an error on Windows.
Even though this winds up calling Close
twice (once in Commit
, once in defer Close
), it's ok because a double-close doesn't throw an error.
Actually, it winds up being slightly better, since now the Close
error is explicitly checked, whereas with defer Close
it is not.