TEHRAN, Iran—A ceasefire deal to pause the war in Iran appeared to hang by a thread Wednesday after the Islamic Republic closed the Strait of Hormuz again in response to Israeli attacks in Lebanon.