Set the file descriptor to -1 so loseConnection will stop reading and writing.