save main context after merging temp changes

The mainContext could become detached from the persistent store because it is rarely saved.
Previously tempContexts could become detached from the mainContext because tempContexts are siblings to the mainContext and they load from the persistent store.