The S&P 500 logged a record high on Wednesday, closing out its best month since November