If you check that all you DX ActiveX objects are Released when you shut the program down and make sure you are not releasing any that aren't created (check if they != null) before releasing them it may fix the problem.
Then again it may not and it may have noting to do with this.