with ExitStack() as stack:
    files = [stack.enter_context(open(name, 'rb')) for name in filenames]
results = [do_smth(file.read()) for file in files]
How to use list comprehension with list of variable number of filenames?