Fix a bug where sending KeyboardInterrupt would deadlock the server.