Sri Lankan prime minister agrees to resign as protesters storm residence of president