Error when traversing assembly with Solidworks invisible

I was wondering if anyone else has had this issue before. I have created a stand alone application that creates a new instance of Solidworks then I set it's visible property to false. I open a top level assembly and start doing a traversal, but when I try to gain access to the assembly doc for a component it gives me a "DisconnectedContext" error in Visual Studio. But if I set the Solidworks session to visible, I don't get this error and my code runs through no problems. Does anyone have any tips or tricks around this? I would really like to be able to have Solidworks invisible so that the user doesn't have to sit and watch all the different documents opening and closing constantly. Any help would be greatly appreciated. Thanks.

SolidworksApi macros