Bagnaia wins Malaysian MotoGP to stand on brink of world title