tcp: init the return value before returning it

When sending, init the return value in case the connection is closing
before returning it.