Steps to Reproduce:
Stops after 500 files
Downloads all files
I have already found the problem, and found a fix for it, I just don't know how to make pull requests on phabricator (or whatever they're called on here), I only use GitHub.
Anyways, it gets the gaicontinue from the query wrong, line 79 of grabFiles needs to be changed to
$gaifrom = $result['query-continue']['allimages']['gaicontinue'];
I have already tested this and it works perfectly.