The agreement is being finalized just days before Donald Trump, known for his hardline stance on Iran, assumes office as US president.