S&P 500 closes at record high for second consecutive session