It is possible that you have a read or write action in the UI thread that is hanging because you have closed the serial port.
I recommend that you set a flag before closing the port and pause for a short time to allow other threads to finish whatever they are doing.
Ideally you should be using some interlocking to prevent multiple threads accessing the comport device simultaneously.
I generally do this by wrapping my serial port in a seperate class and using an object lock.
nick.crane
Nearly a Posting Virtuoso
1,230 posts since Feb 2010
Reputation Points: 375
Solved Threads: 187