File renaming should be the last operation of an atomic write

That way there is just no possible race conditions.

cc @wisq
I just agreed that defaulting to the original file directory was the best idea ;)