The S&P 500 closed 0.4% higher and posted its sixth straight weekly gain, and the Nasdaq and Dow also each rose 0.4%.All three indexes closed at highs for the year.