Backport PR #6269: Implement atomic save

this should avoid issues with corrupted/lost notebooks when the disk is full
Backport PR #6453: Copy file metadata in atomic save

Closes gh-6405
Backport PR #6581: Properly mock winreg functions for test

Fixes a lot of test failures on Python 3.4 on Windows, caused by importlib trying to use our mocked out winreg functions when reload(path) was called.
Backport PR #6583: Windows symlink test fixes

This should fix the Windows 3.x test failure we've been seeing recently, and another related failure I found when trying to reproduce it on my Windows VM.
Backport PR #6480: only compare host:port in Websocket.check_origin

don't include protocol

- matches tornado's own behavior
- avoids incorrect 403 in http-behind-https proxy situations.

...
Backport PR #6514: Fix for copying metadata flags

Only became apparent when tests ran on a BSD based system.