Disable Command-W in the terminal
To disable ⌘W in Terminal, do the following:


From the  menu in the top left corner of the screen, select System Preferences. Click on Keyboard then Keyboard Shortcuts then Application Shortcuts.

Click the + button to add a new shortcut
Select "Terminal.app" for the application, and for the command, type Close Window (this is case sensitive). In the shortcut box, give it a different shortcut, like ⌘ControlW 
Now ⌘W will not close your terminal windows.