How to close window and use async after post some data in JS

I would like to set button by whicy some data was sent by form andsubmit follwonig register was called byonclick event.

onclick="register()"
 const register = async () => {
    postRequest('someElement', '/someurl').then(() => window.close())

}
 const postRequest = async (elemTargetFormId, formAction) => {
    const elemForm = document.getElementById(elemTargetFormId)
    elemForm.action = formAction
    await elemForm.submit()
}

My desired result is after sent data,window will be closed.
But in fact, these data was not sent to server and close window.

What is the root cause of them?
How can I wait post request?

Thanks