--- tclEvent.c	Mon Sep 24 13:39:10 2001
+++ tclEvent.c	Mon Sep 24 13:49:01 2001
@@ -795,15 +795,6 @@
 	Tcl_MutexUnlock(&exitMutex);
 
 	/*
-	 * Clean up the library path now, before we invalidate thread-local
-	 * storage.
-	 */
-	if (tsdPtr->tclLibraryPath != NULL) {
-	    Tcl_DecrRefCount(tsdPtr->tclLibraryPath);
-	    tsdPtr->tclLibraryPath = NULL;
-	}
-
-	/*
 	 * Clean up after the current thread now, after exit handlers.
 	 * In particular, the testexithandler command sets up something
 	 * that writes to standard output, which gets closed.
@@ -907,6 +898,15 @@
 	}
 	TclFinalizeIOSubsystem();
 	TclFinalizeNotifier();
+
+	/*
+	 * Clean up the library path now, before we invalidate thread-local
+	 * storage.
+	 */
+	if (tsdPtr->tclLibraryPath != NULL) {
+	    Tcl_DecrRefCount(tsdPtr->tclLibraryPath);
+	    tsdPtr->tclLibraryPath = NULL;
+	}
 
 	/*
 	 * Blow away all thread local storage blocks.
