diff -urNp gnome-terminal-2.22.3-orig/src/terminal-window.c gnome-terminal-2.22.3/src/terminal-window.c
--- gnome-terminal-2.22.3-orig/src/terminal-window.c	2008-08-01 16:23:04.000000000 +0530
+++ gnome-terminal-2.22.3/src/terminal-window.c	2008-08-01 17:55:43.000000000 +0530
@@ -1367,14 +1367,9 @@ selection_changed_callback (TerminalScre
 }
 
 static void
-close_button_clicked_cb (GtkWidget *widget, GtkWidget *screen)
+close_button_clicked_cb (GtkWidget *widget, TerminalScreen *screen)
 {
-  GtkWidget *notebook;
-  guint page_num;
-
-  notebook = gtk_widget_get_parent (GTK_WIDGET (screen));
-  page_num = gtk_notebook_page_num (GTK_NOTEBOOK (notebook), screen);
-  gtk_notebook_remove_page (GTK_NOTEBOOK (notebook), page_num);
+  terminal_screen_close (screen);
 }
 
 static void
@@ -1498,6 +1493,7 @@ terminal_window_remove_screen (TerminalW
 
   num_page = gtk_notebook_page_num (GTK_NOTEBOOK (window->priv->notebook), GTK_WIDGET (screen));
   gtk_notebook_remove_page (GTK_NOTEBOOK (window->priv->notebook), num_page);
+  g_object_unref (G_OBJECT (screen));
 }
 
 GList*
