U.S. stocks end Wednesday with solid gains, recovering most of the losses from the previous session. A big rally in tech stocks propelled the Nasdaq Composite to a fresh record close.