Using VI server, you can obtain a list of all VIs that are in memory and then open references to each of the VIs. Once you have opened a reference to a VI you can check to see if its front panel is open and if so you can close the front panel. The attached example program (built for LabVIEW 2012) shows how this can be implemented.
In the example below, an array control specifies a group of VIs to exclude from closing. The VI then opens a reference to each of these VIs and compares their names to a list of all open VIs in memory. If the VI is open in memory AND it is not in the exclude list, then the example checks to see if the VI's front panel is open. If it is, then the example closes the VIs front panel and closes all references to the VI. Note that a VI is unloaded from memory when it's reference is closed.
You can also configure a VI to close after it completes during edit-time. To select the behavior of the subVI's front panel when called, right-click the subVI and select SubVI node setup