Stocks end tumultuous week on an up note