File renaming should be the last operation of an atomic write