I'm not an expert with Access forms, though I have been getting by pretty well learning this stuff all summer long. When I've been trying to run visual basic code when exiting a text field, I found myself stuck trying to run certain commands from within certain events. In my case I wanted to check if the entry was valid, and if not set the focus back to that text field, and a few more details worked in. What I did was created a global variable as a boolean within the form's code, and in the form's onload event set the variable to false. Then on the text field's before_update event I'd check the validity of the field and if it were invalid I set the boolean variable to true. Then on the text field's lost_focus event if that boolean variable were true I could then set the focus back to the text field and set the boolean variable back to false.
Give this a try, modify it a bit to fit your situation, like check your condition in the before_update event then close the form in the lost_focus event. I can't guarantee this will work as I've never done this myself, but it's always worth a shot.