What if the main window is closed?

This might be a stupid question, but it caused me a lot of headaches:

in the Application class you have something called the ‘main window’. You can retrieve it with Application.getMainWindow(), and by default it’s the first window that is opened. In my code, if I want to open a URL (to download a file for example), I do something like getApplication().getMainWindow().open(new ExternalResource(url));

Now, suppose I open multiple tabs pointing to the same URL. I implemented the ‘getWindow(name)’ method in my Application class to return a new appliation if there wasn’t any yet for that name, so I end up with multiple windows, one for every tab, each window associated with the same application instance (I use the singleton pattern as described in
this wikipage

So far so good, I can still do ‘getApplication().getMainWindow().open(new ExternalResource(url));’ and it works.

However, if I close the first tab I opened, the main window closes, and any subsequent attemp to download a url using the mainWindow is simply ignored.

I solved my problem by not using the main window to dowload a file, but the top-level parent of the window that triggered the download request (the dialog for example). My question is: is there any side-effect of using a non-main window? If no, what is the notion of the main window used for? Are there any other use cases that require the main window, and if yes, what should I do when the main window is closed?

Kim Marivoet