write to tmp config file then move to final location to try and avoid reading mid-write