I'm having the same issue here.
I'm running an external application that creates parts in Solidworks. Even though I save and close the part after building it, some residule GDI objects are not release. after a couple hundred parts the GDI approches the limit and I get a resource warning.
I can set up the program to restart solidworks when it encounters this error and it will release the GDI objects, but I would rather have a better solution in solidworks to handle this issue.
I'm looking for a similar solution to have the GDI objects released when a part window is closed.
If I find a solution I'll post it.