You and others are saying Comey hurt Hillary at the end. I don't think that's true. At the end he said the investigation was off. That only helped her, because before that we were told that an FBI investigation into Hillary was at least possibly underway.
The narrative that he hurt her by bringing up the subject again doesn't make sense. The Republicans certainly were bringing up the subject on their own. "Lock her up" etc.
Comey's intent must have been to push her over the top in what was shaping up to be a closer contest (after cheating applied) than they had expected.