I will present an alternative view to tohster's definition of what X should do, based on what how I think your average user will interpret it. Your average user's mental model of how a computer works will probably not contain a sharp distinction between close/exit/quit, instead they are likely to have one "favourite" term that they use for all of these. I know that in the early days of GUIs, there was research into exactly this when developers/designers were what to call the appropriate menu option. I also suggest your average user's mental model will not make a clear distinction between application and window. Of course these distinctions are vital to the programmer, but not to the user.
I suggest that the common meaning of an X icon - principally in the windows world, but increasingly also on the web - is "get rid of the thing containing the X". That's a deliberately non-technical description since your average user won't think in technical terms in the first place. What "get rid of" means depends on context of course.
That, for me, is why new uses of X work and are generally "intuitive" - tag lists as in tohster's example; the X that appears when you hover on a preview image in your own facebook post, the X on a tab in a browser. Or imagine you're reading an article on a news site when half way through, a semitransparent overlay appears with a box in the middle inviting you to enter your e-mail address to "sign up for further articles that may interest you". What do you do? You look for something X-like to get rid of the **** thing and continue reading. Or you decide you've had enough and X the whole tab, then get back to whatever you were supposed to be doing before you started reading that article.
There is actually another kind of X - the one that means "error". Back in win95 days, dialog boxes when something had gone badly wrong - "this program has performed an illegal operation and will be terminated" - had an icon of a white X in a red circle. More than once I had to explain to a colleague that no, you don't click that icon to make the thing go away!
In some contexts, "get rid of" translates to delete, like in tohster's tag list example or a preview image in a facebook post. For the X in a title bar, if you're in a simple one-window application then the usual behaviour is to terminate the application, which our average user may well call "close the window". Windows "single document" applications like mspaint, notepad etc. work like this. For explorer of course, closing a window doesn't necessarily translate to closing a process (unless you have ticked "start each window in a separate process"). Back in the days when winword.exe had "multiple-document" interface, that is one big window for the application in which you could tile or otherwise arrange multiple "document windows", each window had its own X - the outer one closed the application and all documents, the ones on an inner window closed a single document window. And of course, if there were unsaved changes then a confirmation box appeared first.
But back to the original question - what should happen if someone clicks an X in a program's window? Definitely: that window should disappear. Should the associated program close? It depends.
For your usual applications (word etc.), closing the window closes the program (sometimes with a confirmation dialog box if you have unsaved changes). Indeed, this is probably the only way many people know to close a program.
For a web browser, behaviour varies. Should you close the application if there's multiple tabs open? Firefox asks the user. If there are downloads going on in the background? Both firefox and chrome ask, as far as I know, but you can set this in the preferences.
Terminating a windows explorer window does not of course end windows, or the main explorer process (which is responsible for the start button and taskbar).
Closing an antivirus program's window should not of course terminate the background scanner!
Process Explorer (an advanced task manager) is interesting. By default, X closes the process. But you can set in the menu whether you'd prefer X to act as minimize, and even whether you'd like a minimised process explorer to appear in the task bar or only in the icons area.
So having the X not terminate the program is not generally bad UX - it depends on the context, I'd argue.
Which brings us, finally, to skype. I personally find its behaviour annoying - I always close it by right-clicking the taskbar icon then selecting "Quit Skype". And note that even in this menu, "close window" has an X icon whereas Quit does not.
But you can argue both ways. The designers' hypothesis seems to be something like "skype runs in the background whenever the computer is on - friends can call you whenever you're online". The question we really need to ask is whether or not that's what most skype users would prefer or not, and that question has very little to do with X buttons.
Does this kind of behavior should be considered as bad UX?
The only way to find out is to ask lots of people what they expect/want to happen if you click the X, then a friend tries to call you: if most say "they can't call you because you closed the program", then it's bad UX because it doesn't match peoples' expectations. If most say "a window pops up announcing the call" then skype got it right. I have my opinion on what I'd like to happen but one data point alone doesn't mean anything.