S&P 500 posts record high for 46th time in 2024 as elections draw closer