Macro Crashing after opening and closing ~100 parts

I'm running a macro that opens each item in the BOM, saves an image of the model, steps and repeats. On large assemblies, (1000+ parts) SolidWorks tends to crash after opening ~100 parts. 

SW2021SP2, Lenovo P72, Xeon, 64Gb of RAM, Quadro P5200

I make the component visible with:

           swComponentModel.Visible = True

save the image...


And I found if I only closed it by:

           swComponentModel.Visible = False

All 64GB of ram would fill and crash. 

So I now close by:

           swCopmonentTitle = swComponentModel.GetTitle
            swApp.CloseDoc (swComponentTitle)

The ram doesn't overflow, but now it crashes around 100 - 113 documents processed. 

Is there a known issue and fix for opening over 100 documents in a single session?

Is this issue related to the GDIProcess Handles & User Process Handels. 
I've already turned those up to:

           [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows]
           "GDIProcessHandleQuota"=dword:00010000
           "USERProcessHandleQuota"=dword:00004650