io: handle half-closed connection when peer closed first

This allows to send data back to the peer even if the peer already has sent
EOF/FIN as specified for TCP. To fully close a connection, the handler has
to close its side of the connection now actively once it is finished with
writing even if it received a `PeerClosed` message before.
TcpConnection: use pattern matching
Tcp: hide support for half-closed connections behind Register.keepOpenOnPeerClosed
add Tcp.register overload with `keepOpenOnPeerClosed` parameter for Java usage
Merge pull request #1292 from spray/tcp-peer-half-close-3185

Fix half-closed TCP connection if peer closed first, see #3185