Fix client-side HTTP hijacking over TLS

Properly CloseWrite() the client socket once done with stdin when using
TLS connection (this used to rely on an erroneous type assertion).

Fixes #8658.
Fixes #8642.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Signed-off-by: Michael Crosby <crosby.michael@gmail.com>
Merge pull request #9442 from icecrime/8658-tls_attach_hangs

Fix client-side HTTP hijacking over TLS