Improve INI file backup handling.

When backup is not possible, do not write changes to disk.
When writing the new INI file fails, rename the backup to INI.