I've been running into a weird problem in Safari 3.2.3 lately:
Sometimes, a window will appear that has a grayed-out (and thus non-clickable) Close button.
Quitting and restarting Safari and then reopening windows from previous session doesn't fix the problem. There just doesn't seem to be a way to close the window.
I think this has something to do with "pop-under" advertising windows. Though there are also suggestions online that it has something to do with input managers.
At any rate, my solution the last few times has been to quit Safari and edit the ~/Library/Safari/LastSession.plist file using the property list editor application. Delete the offending window, and everything's fine. But that's really not a very good solution.
Just now, I found a better one, which I'm posting just in case anyone else runs into the same problem:
In the URL bar of the window that can't be closed, type the following:
And press Return. The window should close. (It's possible it'll ask if you really want to close the window, in which case click the OK button or equivalent.)
This also works:
Obviously, don't type that in a window that contains any information you don't want to lose.
P.S.: Doing the above may result in another window becoming invisible. I don't understand that, either, but if none of your windows are foregrounded, and the Window menu shows a checkmark next to the title of a window you can't see, then you can choose File > Close Window (or the equivalent keyboard shortcut) to close the active-but-invisible tab. If the invisible window contains multiple tabs, you'll have to repeat that Close action multiple times. Eventually, all the tabs should be closed and Safari will be back to normal.