My program fails to recover the last JPEG. I see all the JPEGs but CS50 Check doesn't see the last file. I checked it with Valgrind and had no memory leaks. I suspect it has something to do with EOF but I'm not sure... The code is: (removed due to academic honesty) 
Any suggestions?