Stock market close: S&P 500 reaches 36th record high in 2024