wmctrl can close a window based on a substring or exact match of the window title (
wmctrl -c 'substring' or
wmctrl -F -c 'exact match').
If you need more control, you can parse
wmctrl -l, extract the matching window IDs and pass them to
wmctrl -i -c. You can use
wmctrl -x -l and match the class as well; in fact, I recommend it, since applications you haven't thought about might have windows with the same title.