Could be done using a script.
Good starting points:
Snippet: Enumerating listers and tabs
Close all tabs matching a path wildcard