If your application seems to hang, and the window won't go away keep clicking the X icon. After a few seconds a dialog box should appear to indicate the program has become inactive and asking if you want to close it.
If this does not work, you can use xkill to stop it. Press Alt+F2, type xkill, and press Enter. Your mouse cursor changes to a small skull and crossbones. Click the offending application window, and it will finally be banished to that place where naughty applications wallow.