There's no way to handle the error, which sounds like a bug in the OCX, but you might be able to prevent it. Make sure you've got the latest version. Make sure there's nothing you need to dispose or close. Make sure all of the OCX functions have completed when you exit the application. As a last resort, you can try changing or commenting out some function calls to the OCX to see if anything makes a difference.
Now would be a good time to start looking for an alternative to the OCX.