Like your other question, this can be only done with a macro. The macro searches in every file for the term and closes all files which has the term. After macro execution only the files are opened which do not have the search term. You should save all files before the macro is executed. All files must be real files (not buffers) with a file name.