Red Sox beat Royals 7-5, snap 8-game losing streak