File renaming should be the last operation of an atomic write

That way there is just no possible race conditions.

cc @wisq
First because it's already required at the top of the filed. And second because I now use `File.rename` instead of `FileUtils.mv`