ts_close: fix segfault on close
Merge pull request #7 from dougg3/master

ts_close segfault fix