I found the solution.
Credit : Found info here
Here is the code:
void exit() {
    println("Exiting program");
    myPort.stop();  // stoping serial port.
   //your Code above. 
   super.exit();
}
I found the solution.
Credit : Found info here
Here is the code:
void exit() {
    println("Exiting program");
    myPort.stop();  // stoping serial port.
   //your Code above. 
   super.exit();
}