Optimal harvesting of an age-structured population