Implement atomic save

Ping @fperez, this should avoid issues with corrupted/lost notebooks when the disk is full, though I haven't worked out how to test it just yet.

Closes gh-6254
MoveFIleEx is wrapped in pywin32. If pywin32 is a dependency for ipython, it looks like

````
from win32file import MoveFileEx, MOVEFILE_REPLACE_EXISTING, MOVEFILE_COPY_ALLOWED
MoveFileEx(tmp_file,path, MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED)
````

is what you'd want. (The Copy allowed will allow movefile to make a copy of the file if you are moving between volumes where atomic moves are not allowed.)