Stocks lost a grip on early gains, but were still set to finish the week higher.