Fix hanging on some systems

Netcat seems to hang on some systems unless you close the connection.