Fix #504: save config to rc_filename + "~new" and copy it on success