Update TCP Cork, cork and uncork around the writing of the socket

This moves the TCP Corking logic around the writing to the
connection. This is more proper and the ideal behavior for corking
seems to be leave the socket/connection corked for as short a time
as possible. This was originally implemented to try and flag down
a random 5s delay bug. It didn't fix the bug, but I'd like to
keep the changes because of the above reasons.