Close modal on form submission

I have a page that has a modal with a form.
The form needs to be filled in and submitted before anyone can access the page.
I have it set to close the model when the submit button is clicked, but of course, this means anyone can just click the button without filling in the form, and nothing is submitted.

How can I hide the modal only if the form is successfully submitted or add a close button to the success message after it is submitted?
I also then keep it hidden for anyone that has submitted the form, so it doesn’t popup again every time they visit the page.

Here is my public share link: LINK
(how to access public share link)