ArcGIS Pro 2.9 API Reference Guide
CloseLayoutPanes Method
Example 

ArcGIS.Desktop.Core Namespace > LayoutFrameworkExtender Class : CloseLayoutPanes Method
Does not need to be specified.
Layout path.
Close the layout panes that reference the specified layout path.
Syntax
public static void CloseLayoutPanes( 
   PaneCollection paneCollection,
   string layoutUri
)
Public Shared Sub CloseLayoutPanes( _
   ByVal paneCollection As PaneCollection, _
   Optional ByVal layoutUri As String _
) 

Parameters

paneCollection
Does not need to be specified.
layoutUri
Layout path.
Example
//Find and close all layout panes associated with a specific layout.

LayoutProjectItem findLytItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals("Layout"));
Layout findLyt = await QueuedTask.Run(() => findLytItem.GetLayout());  //Perform on the worker thread

var panes = ProApp.Panes.FindLayoutPanes(findLyt);
foreach (Pane pane in panes)
{
  ProApp.Panes.CloseLayoutPanes(findLyt.URI);  //Close the pane
}
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

See Also

Reference

LayoutFrameworkExtender Class
LayoutFrameworkExtender Members