Why did Hagrid die in Harry Potter and the Deathly Hallows?

He didn't.