Sure, but flash has to know that the window is closed. Some onClose function or something like that...
I made flash application which works with flashcom server (media server now) and when I closed the window, flashcom server knows that I disconnect this client immediately...