Attempt to fix install error by ensuring mainfile is written to disk, and then reloaded after settings are saved.