The window can be closed using Selenium (((IWebDriver) context.Browser.Driver.Native).Close()). This "breaks" the underlying Coypu.BrowserSession in WebTestHelper.MainBrowserSession, which needs to be replaced by a new instance representing the new root window.
A new API could be added, allowing to change the root browser window. When closing a browser window, a guard should check if it is the root window and if so, throw an understandable exception.
It is possible in Remotion.Web.Development to create a new BrowserSession without a parent context, but when trying to close this browser session an error is thrown that no parent context is available.
A parent context should not be required for creating and closing browser sessions.
The method Remotion.Web.Development.WebTesting.CoypuBrowserWindowExtensions.CloseWindow should not check whether a parent context has been provided.
Adding the following test to MultiWindowTest reproduces this issue: