I remember having somehow the same problem. Each time i would try and close the port, my program would just hang. Then i figured out that my closing method had to be synchronized. And did something like this:
synchronized void closePort(){
if(serialPort!=null){
try{
output.close();
input.close();
}catch(IOException ex){
}
serialport.close();
serialport.removeEventListener();
}
}
And this actually worked for me. It's not much, but i hope it will also work for you.
Best regards.