Solidworks resource monitor

Solidworks resource monitor indicates low resources when running macro to update toolbox copied parts.

Is there a way to get Solidworks to shutdown after the resources get to a certain level, (or after a certain number ofdocuments processed)  restart and then carry on with the next document?

Thanks

SolidworksApi macros