David Miliband to resign as MP for job at non-profit