Chris Woakes took five wickets as England beat Pakistan by 54 runs to win the fifth ODI at Headingley. The victory saw England to a 4-0 series win after the first match was washed out.
Woakes took three wickets for no runs in nine balls as Pakistan slumped to six for three in pursuit of 352.
Babar Azam (80) and Sarfraz Ahmed (97) then kept Pakistan in the game before both batsmen were brilliantly run out.
Woakes needed just three balls to have Fakhar Zaman (0) caught by Joe Root at second slip. Abid Ali (5) was then trapped in-front by Woakes.
Woakes then nipped one back to have Mohammad Hafeez lbw for nought, although replays suggested umpire Paul Reiffel's verdict may have been overturned if Pakistan had reviewed the decision.
England will have to reduce their 17-man squad to 15 for the World Cup and captain Eoin Morgan told BBC Radio's Test Match Special: "I could pick 17 at the moment. It is going to be an extremely tough selection."
Pakistan captain Sarfraz Ahmed said: "Result-wise it is not ideal for the World Cup. But the way the batsman are batting we are ready for the World Cup.
"We have taken some positives but we need to sort out our bowling and fielding."
After Pakistan's top-order collapse Babar carried on from his 115 in the last game with a 59-ball fifty. But the fourth-wicket partnership of 146 ended in frustrating fashion for Pakistan.
Sarfraz prodded at an Adil Rashid delivery and set off for a single. But Jos Buttler moved quickly from behind the stumps to throw the ball to the bowler's end where Rashid, with Babar trying to regain his ground, flicked the ball onto the stumps from behind his back without looking to complete a run-out.
Rashid then dismissed Shoaib Malik with a diving left-handed catch off his own bowling.
Safaraz was denied what would have been his third ODI hundred in bizarre fashion.
Buttler, having stopped the ball with his boot, saw the rebound fall kindly to run out Sarfraz, who narrowly failed to ground his bat in time.
Pakistan were eventually all out for 297 in the 47th over.
Earlier, England were set for a huge score at 191 for two off 25 overs. But a collapse of sorts in the second part of the innings saw Pakistan make a recovery. Joe Root made 84 while Morgan made 76. The duo added 117 for the third-wicket partnership. But it still needed Tom Curran's unbeaten 29 to take England past 350.
Imad Wasim took three for 53, while Shaheen Shah Afridi had four for 82.
The last over saw Curran hit a six and then ramp an outrageous four off successive Hasan Ali deliveries.