fixed concurrent issues at bulk retry logic

how can activeWriter be 0 here if it has been incremented 3 lines above?