The US president said he believes Tehran will agree a deal after November’s midterm elections but warned of further escalation