(gdb) bt
#0  Tcl_Panic (format=0x7f3669f8e308 "FlushChannel: damaged channel list")
    at /home/sbron/tcl/tcl/generic/tclPanic.c:109
#1  0x00007f3669ec7927 in CutChannel (chan=0x7f3664084420)
    at /home/sbron/tcl/tcl/generic/tclIO.c:3206
#2  0x00007f3669ec7633 in CloseChannel (interp=0x1918ca0, 
    chanPtr=0x7f3664084420, errorCode=0)
    at /home/sbron/tcl/tcl/generic/tclIO.c:3066
#3  0x00007f3669ec73bc in FlushChannel (interp=0x1918ca0, 
    chanPtr=0x7f3664084420, calledFromAsyncFlush=0)
    at /home/sbron/tcl/tcl/generic/tclIO.c:2950
#4  0x00007f3669ec7f43 in Tcl_Close (interp=0x1918ca0, chan=0x7f3664084420)
    at /home/sbron/tcl/tcl/generic/tclIO.c:3503
#5  0x00007f3669ec58b0 in Tcl_UnregisterChannel (interp=0x1918ca0, 
    chan=0x7f3664084420) at /home/sbron/tcl/tcl/generic/tclIO.c:1280
#6  0x00007f3669ed3c11 in Tcl_CloseObjCmd (clientData=0x0, interp=0x1918ca0, 
    objc=2, objv=0x191cf60) at /home/sbron/tcl/tcl/generic/tclIOCmd.c:697
#7  0x00007f3669dba93a in Dispatch (data=0x19ddaf8, interp=0x1918ca0, result=0)
    at /home/sbron/tcl/tcl/generic/tclBasic.c:4375
#8  0x00007f3669dba9a1 in TclNRRunCallbacks (interp=0x1918ca0, result=0, 
    rootPtr=0x195f270) at /home/sbron/tcl/tcl/generic/tclBasic.c:4391
#9  0x00007f3669dbd4a5 in TclEvalObjEx (interp=0x1918ca0, objPtr=0x19dd670, 
    flags=131072, invoker=0x0, word=0)
    at /home/sbron/tcl/tcl/generic/tclBasic.c:5834
#10 0x00007f3669dbd439 in Tcl_EvalObjEx (interp=0x1918ca0, objPtr=0x19dd670, 
    flags=131072) at /home/sbron/tcl/tcl/generic/tclBasic.c:5815
#11 0x00007f3669ecf2b1 in TclChannelEventScriptInvoker (clientData=0x1a1d600, 
    mask=4) at /home/sbron/tcl/tcl/generic/tclIO.c:8920
#12 0x00007f3669ece939 in Tcl_NotifyChannel (channel=0x7f3664084420, mask=4)
    at /home/sbron/tcl/tcl/generic/tclIO.c:8391
#13 0x00007f3669f5a6c8 in WrapNotify (clientData=0x7f366408bd30, mask=4)
    at /home/sbron/tcl/tcl/unix/tclUnixSock.c:1036
#14 0x00007f3669f5d33c in FileHandlerEventProc (evPtr=0x1a1d680, flags=-3)
    at /home/sbron/tcl/tcl/unix/tclUnixNotfy.c:276
#15 0x00007f3669ef7bc6 in Tcl_ServiceEvent (flags=-3)
    at /home/sbron/tcl/tcl/generic/tclNotify.c:670
#16 0x00007f3669ef8006 in Tcl_DoOneEvent (flags=-3)
    at /home/sbron/tcl/tcl/generic/tclNotify.c:967
#17 0x00007f3668c2305b in ThreadWait (interp=0x7f3664002f10)
    at ../generic/threadCmd.c:2830
#18 0x00007f3668c203d8 in ThreadWaitObjCmd (dummy=0x0, interp=0x7f3664002f10, 
    objc=1, objv=0x7f366400e8b0) at ../generic/threadCmd.c:1100
#19 0x00007f3669dba93a in Dispatch (data=0x7f3664004f18, 
    interp=0x7f3664002f10, result=0)
    at /home/sbron/tcl/tcl/generic/tclBasic.c:4375
#20 0x00007f3669dba9a1 in TclNRRunCallbacks (interp=0x7f3664002f10, result=0, 
    rootPtr=0x0) at /home/sbron/tcl/tcl/generic/tclBasic.c:4391
#21 0x00007f3669dba115 in Tcl_EvalObjv (interp=0x7f3664002f10, objc=1, 
    objv=0x7f366400e8b0, flags=2097168)
    at /home/sbron/tcl/tcl/generic/tclBasic.c:4134
#22 0x00007f3669dbc900 in TclEvalEx (interp=0x7f3664002f10, 
    script=0x7f3664079eb0 "thread::wait", numBytes=12, flags=131072, line=1, 
    clNextOuter=0x0, outerScript=0x7f3664079eb0 "thread::wait")
    at /home/sbron/tcl/tcl/generic/tclBasic.c:5213
#23 0x00007f3669dbbc6d in Tcl_EvalEx (interp=0x7f3664002f10, 
    script=0x7f3664079eb0 "thread::wait", numBytes=12, flags=131072)
    at /home/sbron/tcl/tcl/generic/tclBasic.c:4877
#24 0x00007f3668c2176b in NewThread (clientData=0x7fff77ece230)
    at ../generic/threadCmd.c:1817
#25 0x00007f3669e98854 in NewThreadProc (clientData=0x1a1d540)
    at /home/sbron/tcl/tcl/generic/tclEvent.c:1567
#26 0x00007f366973d569 in start_thread () from /lib64/libpthread.so.0
#27 0x00007f366913c9ef in clone () from /lib64/libc.so.6
