Screen error after 80 trials

I am trying to display a set of 40 images in 4 blocks (160 total images) with calibration between each block. When I run the code the way I have it for any combination of two blocks of 40 it works great, but if I try to loop through all 4 I get an error with Screen

textureIndex=Screen(‘MakeTexture’, WindowIndex, imageMatric [, optimizeForDrawAngle=0] [, specialFlags=0] [, floatprecision=0] [, textureOrientation=0] [, textureShader=0];

Error in script
Stimtex(i)=Screen(‘MakeTexture", wp, imread9[imagedirectory,trial_order{i,2},’.jpg’]))

Is there some reason that Psychtoolbox can’t handle displaying this many images? Again if I just loop through two blocks its fine

Matlab 2015a 32-bit
Psychtoolbox 3.0.11
Windows XP

There’s probably more error info higher up in the command window, post that

But first guess: do you close the texture that you make with maketexture after you no longer need it? You may be running out of memory