President Barack Obama swatted away as "foolish" pledges from would-be 2016 presidential candidates to undo the nuclear deal being finalized with Iran if elected.