Changed the order of operations when add new settings

Writing the header first for new Settings entries in the settings manager is potentially unsafe and may store invalid values if power is lost between writing the header and the value.