U.S. stock markets closed higher on Thursday as artificial intelligence (AI) trade regained momentum.