Moved config saving to when one exits the config state.