Shored up the saving of data by using the write + rename idiom.