Fix bugs with getFile in async mode.

A nested function was referring to a local in the outer function, but it was modified in a loop, so the nested function always referred to the last entry in the loop, instead of the entry when the function was created.

Also changed fetchAll to not recursively call itself in async mode.  Instead after each async files text is retrieved check to see if all the files are done.  Otherwise the same files were getting requested many times.