Close a document

Closes the specified document. Optionally saves changes before closing.