Deal would be foreign-policy success but ending war will require president to keep pushing for tough negotiations between Israel and Hamas