Major U.S. indexes gave up their strong early gains and turned lower, setting them on track to finish a bumpy week on Wall Street with losses.