If the protocol instance this is attached to provides
IHalfCloseableProtocol, it will get notified when the operation is done.
When closing write connection, as with loseConnection this will only happen
when buffer has emptied and there is no registered producer.

Enabling SO_KEEPALIVE sends packets periodically when the
connection is otherwise idle, usually once every two hours. They are
intended to allow detection of lost peers in a non-infinite amount of
time.