code: protected void releaseCommPortConnection()
      {
          //get reference
          Connection<CommPortAdapter> connection=this.commConnection;
          this.commConnection=null;
  
          if(connection!=null)
          {
              //get logger
              Logger logger=this.getLogger();
  
              try
              {
                  //release connection
                  logger.logInfo(new Object[]{"Closing COMM port connection."},null);
                  connection.close();
              }
              catch(Exception exception)
              {
                  logger.logError(new Object[]{"Error while closing COMM port connection."},exception);
              }
          }
      }
docs: Releases the COMM port connection if open.