I'll start with the obvious... Using COM with c# Interops in Templates is not a supported scenario.
Now, moving forward, it is clear that something in your templates might be doing a lousy job of releasing resources once they're used. In the good old VBScript days we would do something like this in our code:
Set someObject = CreateObject("someobject")
' some logic
' some more logic
Set someObject = Nothing
This would release the object and make sure our code was clean and properly released. With c# and COM Interops you still need to make sure your COM references are released, even if some Microsoft documentation suggests that this is not needed (in my experience, .NET 1.1 interops had a lot less issues with this than anything after .NET 2.0).
You can achieve the same result by using:
object someobject = new object();
// some logic
// some more logic
Be careful with how you use this. Marshal.ReleaseComObject will return an
int with the number of current references to that same object. Do NOT fall into the temptation of releasing them all, as you will start getting errors related to "object is not available anymore".
COM Marshalling is not that hard to start using, but pretty hard to use correctly. Ideally, move your code to TOM.NET or, if this is not an option, try to stick to using a native COM language when dealing with the COM Object Model.