[Issue286] Add support for atomic file renaming

See #286.
Or maybe use fine?