Oil prices closed sharply higher Thursday despite President Donald Trump’s pledge not to resume U.S. airstrikes on Iran before the November 3 midterm elections.

Brent crude settled at $104.28 a barrel, up 4%, after nearing $106. U.S. crude finished at $91.49, a gain of 3.6%. Prices dipped briefly after Trump’s announcement, then recovered. European benchmark diesel futures rose 6%, while heating oil climbed more than 5%.

Trump also said the United States was having productive discussions with Iran. Traders were weighing reports of attacks by Iranian proxies in Saudi Arabia. Separately, oil companies suspended work at several Gulf of Mexico rigs and evacuated crews as a precaution because of Hurricane Isaias.

The 10-year Treasury yield fell after Trump’s post. Stocks fluctuated during the day but were largely unaffected by his announcement.