Great trick. What it really does is capture the signal sent by clicking the close button and smother it. This prevents the button from working, but doesn't necessarily make it go away (it doesn't on the Windows machine I am using just now)-- which as a user-interface thing is bad. The user who tries to click the close button may actually become frustrated and close the window some other way. Or they may just think the programmer is incompetent. ;)
By the way, you can get around the bareword issue by simply quoting: "WM_DELETE_WINDOW".