Royals hang on to defeat Giants to win Game 3