The S&P 500 closed Wednesday at a fresh all-time high of 7,022.95, surpassing the late-January peak and capping a remarkable round trip from the spring selloff.