If-then consecutive

maybe it's a stupid question, but I can't understand.
I have three consecutive if-then blocks.
This is more or less the code:

In the second inner block, there is a call to a dialog (to insert a password).
But third if-then block start anyway, without waiting for the end of second (confirmation on password dialog).

I thought that the next block starts when the previous one ends
Someone can explain why it happen?

the blocks do not wait...
Just use an if then else block and move your runQuery procedure call into the else part

If password is empty
Insert password