Buttler, Woakes lift England to leave first Pakistan Test on knife’s edge