How to open and dismiss windows in visionOS

The SwiftUI App file defines window groups to create multiple windows. By using the openWindow and dismissWindow environment values, windows with specific id values can be opened and closed easily.