Stocks closed higher on Wall Street as the market posted its fifth straight gain and the Dow Jones notched another record high.