Hello,
Finally got it working. We had another dll running in a thread called websockets.dll. When the LabVIEW is closes, the dll is been released while thread is till running. We modified the dll to shutdown the thread when we run the Unregister(). which solved the problem.