Nope,
$widget->hide() merely does what the name suggests.... hides the widget from view but doesn't destroy it. Suprisingly enough, $widget->destroy() is your puppy here๐ Use the following method as a secondary window destroy event handler:
function closeWindow($widget) {
$window = $widget->get_toplevel();
$window->destroy();
unset($window);
}
Remember not to use this on the program's main window as it will kill the window but leave the process running in the background.
-geoff