Train drivers have voted to accept the latest pay offer from ScotRail after weeks of reduced timetables amid the dispute.