Try the following code in the click method of your command button. It works :-)
CLEARDIRWAITwindThisForm.cls
I think that most of us here would tend to place the output in a different window, which when closed reveals the starting window beneath. But of course it's up to you.