fix TCP socket leaking