Is this possible? I often happen to have opened more than one document and after editing one I click on close without remembering that I actually just wanted to close that tab.
If you know C++ then it is possible to get hold of the source on sourceforge.net and it's probably not that hard to get it to do what you want. Otherwise I don't think its realistically possible.
But in the preferences editor there are various options that could make a sort of workaround. In the Global tab set Enable close button on each tab to true. This puts a little 'x' on each tab. In the MISC tab make sure that the Remember the current session for next launch is checked. This means that if you accidentally close the whole program then at least you won't have to open each file again.
Personally I prefer to close tabs using the middle mouse button. It is also possible to use the shortcut mapper to make CTRL-F4 close the tab which is the shortcut most other programs use.
Can't find anything to make it behave as you wish but I can add to the list of ways to close them.. In my day to day work I often end up having more than 20 - 30 tabs open at any time.
CTRL-W is how I like to close them since I always have my hands on the keyboard and mousing around is slower.
Somewhat unrelated but if you work with a lot of tabs and want to save yourself some time clicking around looking for tabs, you can also get the File Switcher plugin. Once installed, I believe the shortcut is CTRL-SHIFT-o. Once that's up, you can start typing the name of the file, or the path (if you enable search within path in the options) and it'll highlight that file, then hit enter and it'll switch to it. Seems like a lot of work but takes 3 keys to launch then 1 to 10 keys to switch documents. When I have 40 files open this saves a LOT of time instead of clicking through and trying to remember where they were in the tab bar.