Before your program exits, the COM library must be uninitialized.
Your SQL-DMO program does not need to uninitialize OLE. Visual Basic automatically uninitializes OLE and COM when your program exits.
After completing all use of SQL-DMO or COM functions, your program must uninitialize the COM library by calling the OLE CoUninitialize function. For example:
CoUninitialize ();
To uninitialize OLE you can use the OleUninitialize function. This automatically uninitializes the COM library.