Nepal averts crisis, PM agrees to quit