some major overhauling of the tcp sliding window closing mechanism to close cleanly