I think that what you mean is how you can load other urls when you close a window.
It is quite easy if you use the onUnload event, this event make happen when you unload or close the window. In this moment you can open a new window, show a message,...
<body onUnload="alert("This can be a solution");">
I think that is what you want.