You're not wrong. Comey is a naive patriot who was protective of the FBI. It was a difficult one for him to make. Imagine if he said nothing and the country elected her, only for the new investigation to find something worthy of charging her; the credibility of the FBI, the Justice Department, and the Obama administration would have been in the gutter. Going public was the only viable option.
I completely recognize that his letter led to a Trump victory, but it truly was the only option given the uncertainty of how long the new investigation would last. That said it was extremely naive of him to believe that the GOP and the public would not go nuts over the letter.