Remove defer

On windows, a file open for writing may not be moved. We need to close the file once we are done with it and moving it after.