In his final foreign policy address before he leaves office next week, the US president said an agreement between Israel and Hamas to secure the release of hostages and achieve a ceasefire is close.