Fix race condition in Prefetching when using with a TChain.

Avoid race condition when moving from one TFile to another in a TChain by using a TSemaphore to mark the fact that there are still some prefetch requests in flight. By using this we ensure that the TTreeCache ( i.e. also the TFilePrefetch obj) is moved to the next file only when all in-flight requests are received. There are three things we need to take care of when moving the cache:
- make sure the async thread is not doing any work
- clear all blocks from prefetching and read list
- reset the file pointer in the prefetch obj

This was discovered when testing Prefeching on Alice jobs.  While using it on TChains, we discovered a race condition which was quite hard to replicate on a simple test machine and required some traffic shaping to spot it.

[From Elvin]
Avoid assert in rootcling/genreflex just because there is a user error
Avoid creating an empty output file even in case of early failure