save unsaved memory when exit service