dont use separate object for each file. use counter and mutex tomake it thread safe