Stocks trim weekly losses with a bullish Friday