ok, I've not done this sort of thing before, but here are my thoughts...
What's the nature of the process? I'd imagine that it's a looping script that inserts into a found set of records?
I think that you may indeed be looking at a timing issue.
It would be great if there way some way to confirm the contents before moving on with the next record... perhaps if the image is displayed in a web viewer (from filemaker) and the content checked, before moving to the next? Not sure if that's possible.
I'd be even looking at caches and clearing them as you go.
It's a tough one to trouble shoot, there could be a number of variables that get in the way of a good result. I think a lot of experimentation... tweaking as you go. Pause/Resume for a few seconds between each step to allow for timing issues. Perhaps even mark the records that have errored and re-run the script on those separately a second time??
Don't really know... just throwing my thoughts down here.
I am with Peter on this. Pause/Resume may fix this. I would start with 1 to 2 seconds and then work my way to .1 seconds until it is at it's fastest, but still reliable.
The hosting server may have an issue with being hit with too many http requests per unit time from your IP or in total.
There may sometimes be a delay in the server serving out the file and the script moves on without the files finishing.
Could be an issue with FM15, but see if pause helps first. Maybe test FM14/ElCap to narrow it down?