--- tcl84.orig/generic/tclIO.c	2008-12-01 13:36:03.000000000 -0800
+++ tcl84/generic/tclIO.c	2008-12-01 13:32:36.000000000 -0800
@@ -235,7 +235,7 @@
 	     statePtr != NULL;
 	     statePtr = statePtr->nextCSPtr) {
 	    chanPtr = statePtr->topChanPtr;
-	    if (!(statePtr->flags & CHANNEL_DEAD)) {
+	    if (!(statePtr->flags & (CHANNEL_INCLOSE|CHANNEL_CLOSED|CHANNEL_DEAD))) {
 		active = 1;
 		break;
 	    }
@@ -302,10 +302,10 @@
 		 */
 		
 		chanPtr->instanceData = NULL;
-	    }
 	    statePtr->flags |= CHANNEL_DEAD;
 	}
     }
+    }
 
     TclpFinalizeSockets();
     TclpFinalizePipes();
