[Issue286] Add support for atomic file renaming

See #286.