Good build up to a powerful ending point. It's not really a downer ending, more of a triumphal one. He did what he had to do and then managed to redeem her honor and his. It would've been nice to have the "happily ever after" but, strictly speaking, it wasn't necessary as he'd completed all of his business. At worst, his death attones for what he did to Pansy and this reader hopes she takes comfort in the fact that he honestly loved her and, despite all, did and gave his best for her.