Optimal harvesting strategies for a metapopulation