Detect if browser is closed

how can i detect if someone has closed the browser that was using the swf. i want to then execute some code, and only then close the browser.

is this possible