Type about:config in address bar and press enter button.
The warning will be appear.
Click “I’be careful, I promise!” and go to configuration page.
For example, If there are many tabs and you don’t want to close a firefox window when
you are closing them with ctrl+W. You can configuration your firefox like this.
1. Search with keyword : browser.tabs.closeWindowWithLastTab
2. double click on “browser.tabs.closeWindowWithLastTab” to switch from “true” to “false“.
After that, your firefox won’t be closed when you use Ctrl+W to close window by mistake anymore.
More information: http://kb.mozillazine.org/Firefox_:_FAQs_:_About:config_Entries