Fix interactive exec over TLS

The code used to expose the exact same problem as fixed in #9442 (i.e.: explicitly type-casting to a `net.TCPConn` when we only require a `CloseWrite() error` method).

Possibly fixes #8679.