Resolute Brathwaite foils Pakistan in third Test