Extracts vels_avg from calc_vels
Adds second semaphore to avoid race conditions
Finishes calc_stats parallelisation. Removes fflushes