U.S. stocks closed lower Friday as a pullback in big AI-focused companies weighed on the market, capping a turbulent week on Wall Street.