read into a BytesIO to avoid "too many open files"