save a document before slept