update window close event handler