Use atomic_write() to have no corruption in case of crashes

The Sage command `with atomic_write()` can be used to avoid corruption while saving files. Modulo bugs, it writes files in a safe way such that an interrupt or a system crash or power failure at the wrong time should do no harm. All important `sagenb` files should be saved this way.