Patch from P. Thoyts fixes the problem, but the test case segfaults on exit.

Backtrace follows:
<verbatim>
(gdb) bt
#0  0x08075599 in Tcl_GetAssocData ()
#1  0x0804d67a in mkClose (instanceData=0x8170380, interp=0x0) at
#2  0x080b86de in TclFinalizeIOSubsystem ()
#3  0x0809d004 in Tcl_FinalizeThread ()
#4  0x0809d160 in Tcl_Finalize ()
#5  0x0809d518 in Tcl_Exit ()
#6  0x08080274 in Tcl_ExitObjCmd ()
#7  0x08077903 in TclEvalObjvInternal ()
#8  0x0807857d in Tcl_EvalEx ()
#9  0x080bf7d7 in Tcl_FSEvalFile ()
#10 0x080c2d52 in Tcl_Main ()
#11 0x0804c2aa in main (argc=135724192, argv=0x2004) at main.c:11
(gdb)
</verbatim>