Atomically replace files