They were able to yet didn't because doing it was sure to provoke a response. In fact if Iran acted first to close the strait it would surely have pulled in all of the European powers.
The only reason they clode the strait is because the US struck first so they had nothing to lose anymore.
"Securing the strait" is completely incoherent as an objective for this war.