J.K. Rowling has stated before that she killed off Hedwig because her death was meant to represent the loss of innocence as Harry grew up and into adulthood (and stared down some Death Eaters). Her death happens during the Battle of Seven Potters in Deathly Hallows as the group is leaving Privet Drive.