changed atomic_replace to atomic_move

which is what most consumers seemed to expect anyways. Moved the code to ensure atomic move into the function vs expecting each module to implement it itself. Hopefully this will prevent problems as seen in #2698 which then lead to #2715.

Also updated modules that used it, so now tmp files won't get left behind even if successful. I left the modules as responsible for cleanup on fail, implemented it in copy but don't know the rest well enough, maybe in subsequent PR.