Fix atomic file writing.

In some weird cases, the subtitle file and its backup, although in the
same directory, can be on different filesystems causing os.replace and
os.rename to fail, in which case we need to fall back to non-atomic
file writing and just use shutil.move.

Adapted from Florian Léger's fork.