S&P 500 closes the book on its steepest first-half slide since 1970