Customization > Automation Interface > Functions > For User Interface > Functions for diagrams > CloseAllWindows function (automation interface)
  
CloseAllWindows function (automation interface)
Syntax:
CloseAllWindows
Closes all open diagrams, text editor windows and Code Editor windows.
* 
You can use the CloseDiagram and CloseTextEditor functions to close an individual diagram or text editor window.
Examples
This example closes all open diagrams:
Call
Studio.CloseAllWindows