RVTDocs.com
Namespace: Autodesk.Revit.UI Class: UIDocument

UIDocument.SaveAndClose

Method
Description:
Close the document, prompting the user for saving it when necessary.
Remarks:
UI dialogs may be shown during the call (e.g. when the document has been changed since last time it was saved) to get user responses. The currently active document may not be closed by this function. It can only be closed via Revit's UI.
Syntax
public bool SaveAndClose()
Exceptions
Exception Condition
InvalidOperationException Thrown when attempting to close the currently active document. Thrown if there are any transactions, sub-transactions or transaction groups which were opened by the API code, and not closed. All of these items must be handled before attempting to close the document.
InvalidOperationException Thrown if this a linked file.