U.S. crude oil ended a four-day loss to end higher on Tuesday, ahead of the official weekly crude stockpile report, even as talks between Iran and the western powers was extended by a week.