@Override
    synchronized public void close() {
        if (isOpen) {
            try {
                if (serialPort != null) {
                    if (serialPort.getInputStream() != null) {
                        serialPort.getInputStream().close();
                    }
                    if (serialPort.getOutputStream() != null) {
                        serialPort.getOutputStream().close();
                    }
                }
            } catch (IOException ex) {
                log.error("Error closing streams, not clean finish up: " + ex, ex);
            } finally {
                try {
                    if (serialPort != null) {
                        serialPort.close();
                    }
                } catch (Exception ex) {
                    log.error(ex.getMessage(), ex);
                }
                isOpen = false;
            }
        }
    }