Updated document map to clear only when last tab is closed.
Updated clone view to save the document when saving the clone.