I am not very knowledgeable with the implementation of ParFor, but I would wager a guess the problem is your indexing: specifically the presence of indx-1 and indx+1.
Try to see if creating three lists of images and indexing them all with indx fixes the problem. Something like:
Imgs = dir([inDir '*.jpg']);
ImgsBefore = circshift(Imgs,1);
ImgsAfter = circshift(Imgs,-1)
im1=imread([inDir ImgsBefore (indx).name]);
im3=imread([inDir ImgsAfter (indx).name]);
As I mentioned, this is simply a guess and might not work. Just come back and let it known if it doesn't.