Support for window close event hook.