I'm assuming that you mean the red x. The red x has one function, to close the window which it lives on.
Since programs have more then one window, making it quit the application doesn't make much sense.
Simply remembering that this is the methodology will make things a lot easier. Quit the application rather then just attempting to close its main window.
But then why quit the program at all? OSX is much better about putting idle programs out of active memory. I typically launch all my programs as I need them; leave them up all day; then quit them all at the end of the day.