Ho to end a home made Shell for windows

I made a shell, like PROGMAN.EXE, no problem so far.
When I finish the shell by kliking on a stop button
the shell stops and windows will return to DOS correctly,
still no problem but when i finish the shell by using ALT-F4
shell stops windows returns to DOS and the computer hangs.
Why o Why please some
help me