@Override
    public void close() throws ChannelException {
        if (port != null) {
            port.removeEventListener();
            port.close();
            port = null;
        }
        inputStream = null;
        outputStream = null;
        super.close();
    }