no idea if there's an onwindow.close() event to trap it , I doubt it exists. But you can however check the existance of the window and if it doesn't execute the funtion.
function checkPop() {
if (popup && !popup.closed) {
}
else {
}
}
setInterval("checkPop()",1000);
popup being the name you gave to the popup window ofcourse.