Yes, trying to open 3200 files is likely to be a problem!
The question is, how can you load them into memory one by one, and keep closing them? I'm not very familiar with PIL, but a glance at the code suggests that the Image.open() calls will create, but possibly
not verify, the images. Does this work?
images = []
for pic in allPic:
img = Image.open(pic)
img.verify()
images.append(img)
allPic = images
Use that instead of your list comprehension. In theory, at least, that should abandon the file objects (not explicitly closing them, alas, but abandoning them should result in them being closed in CPython), so
you ought to get them all opened and read.
Otherwise, someone with more knowledge of PIL may be able to help. According to the PIL docs, this list may be more focussed on what you're trying to do, so if you don't get a response here, try there: