What's the purpose of writing to the temp directory first instead of just writing to the destination file?