Examples:
The following VBA example looks through each open document and its windows and closes all of the windows, leaving open only one window per document.
Sub WindowsItem()
Dim d As Document
Dim w As Window
For Each d In Documents
For Each w In d.Windows
If w.Index <> 1 Then w.Close
Next w
Next d
End Sub