rename, since Windows won't rename an open file. Call remove before rename on
Windows, since Windows rename won't overwrite. Call setPermissions with
previous value plus all read flags, rather than using write flags explicitly.
Replace lots of asserts with QMessageBox::criticals.