UnauthorizedAccessException happens when a USB connected SerialPort is disconnected(physically) and the form is closed.

There does not appear to be a way to Catch the exception and it is not handled with

Private Sub MyApplication_UnhandledException(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException

How can this exception be captured. BTW - the Call Stack shows [ExternalCode]