tcp: fix assert when closing

Reported by George Bosilca <bosilca@icl.utk.edu>
Merge branch 'master' into topic/shmem