Beckett, Red Sox hold on to beat Royals 4-3