Stocks end the week lower amid rising tensions in the Middle East