Dow rallies 400 points to all-time high, S&P 500 tops 5,800 at close for the first time