US stocks have closed higher as investors cheered signs of a peace deal between the United States and Iran.