Sometimes I'm working on something in the terminal, and then go away. When I come back, I want to resume what I was working on, but sometimes I forget, and hit command-Q, which closes all the terminal windows automatically, no questions asked.

Is there a command that can "hold" a Terminal tab so that I don't accidentally close what I was doing?

As an example, what I want can be hackishly accomplished by running sleep LARGE_NUMBER in the tab I want to keep open.

Then if I accidentally hit command-Q, it won't close directly, and rather present me with the following, which gives me an opportunity to cancel and resume what I was doing: