US stocks close with losses as oil surges amid Middle East tensions