UK security adviser in US-Iran talks thought deal was within reach