D-backs sit one game ahead of Dodgers after finale win against Giants