Index: src/pty.c
===================================================================
--- src/pty.c	(revision 2077)
+++ src/pty.c	(working copy)
@@ -1064,9 +1064,10 @@ _vte_pty_close(int pty)
 		if (g_tree_lookup(_vte_pty_helper_map, GINT_TO_POINTER(pty))) {
 			/* Signal the helper that it needs to close its
 			 * connection. */
-			ops = GNOME_PTY_CLOSE_PTY;
 			tag = g_tree_lookup(_vte_pty_helper_map,
 					    GINT_TO_POINTER(pty));
+
+			ops = GNOME_PTY_CLOSE_PTY;
 			if (n_write(_vte_pty_helper_tunnel,
 				    &ops, sizeof(ops)) != sizeof(ops)) {
 				return;
@@ -1075,6 +1076,14 @@ _vte_pty_close(int pty)
 				    &tag, sizeof(tag)) != sizeof(tag)) {
 				return;
 			}
+
+			ops = GNOME_PTY_SYNCH;
+			if (n_write(_vte_pty_helper_tunnel,
+				    &ops, sizeof(ops)) != sizeof(ops)) {
+				return;
+			}
+			n_read(_vte_pty_helper_tunnel, &ops, 1);
+
 			/* Remove the item from the map. */
 			g_tree_remove(_vte_pty_helper_map,
 				      GINT_TO_POINTER(pty));
Index: gnome-pty-helper/gnome-pty.h
===================================================================
--- gnome-pty-helper/gnome-pty.h	(revision 2077)
+++ gnome-pty-helper/gnome-pty.h	(working copy)
@@ -11,7 +11,8 @@ typedef enum {
 	GNOME_PTY_OPEN_PTY_LASTLOGWTMP,
 	GNOME_PTY_OPEN_NO_DB_UPDATE,
 	GNOME_PTY_RESET_TO_DEFAULTS,
-	GNOME_PTY_CLOSE_PTY
+	GNOME_PTY_CLOSE_PTY,
+	GNOME_PTY_SYNCH
 } GnomePtyOps;
 
 void *update_dbs         (int utmp, int wtmp, int lastlog, char *login_name, char *display_name, char *term_name);
Index: gnome-pty-helper/gnome-pty-helper.c
===================================================================
--- gnome-pty-helper/gnome-pty-helper.c	(revision 2077)
+++ gnome-pty-helper/gnome-pty-helper.c	(working copy)
@@ -763,6 +763,13 @@ main (int argc, char *argv [])
 			}
 			close_pty_pair (tag);
 			break;
+
+		case GNOME_PTY_SYNCH:
+			{
+				int result = 0;
+				n_write (STDIN_FILENO, &result, 1);
+			}
+			break;
 		}
 
 	}
