Read/write all pending stuff before quitting.