Giants score three in ninth to beat Braves 4-3