Stokes and Bairstow see off Pakistan in 4th ODI