The built-in recovery system restores the base state by making sure that the non-Web application is running, is not minimized, is active, and has no open windows except for the main window. To ensure that only the main window is open, the recovery system attempts to close all other open windows, using an internal procedure that you can customize as you see fit.
To make sure that there are no application windows open except the main window, the recovery system calls the built-in CloseWindows method. This method starts with the currently active window and attempts to close it using the sequence of steps below, stopping when the window closes.
When the window, and any resulting confirmation dialog box, closes, CloseWindows repeats the preceding sequence of steps with the next window, until all windows are closed.
If any of the steps fails, none of the following steps is executed and the recovery system raises an exception. You may specify new window closing procedures.
In a Web application, you are usually loading new pages into the same browser, not closing a page before opening a new one.