Only write config file if something has changed