Alastair Cook scored his 33rd century in his final Test innings for England, with overthrows from Jasprit Bumrah taking him to the milestone.