Theresa May has seen off a potential defeat over her flagship Brexit bill, after last-minute concessions which could give MPs a bigger say on the final withdrawal agreement.