Google had an extension to do that called [Chrome Toolbox](https://chrome.google.com/webstore/detail/chrome-toolbox-by-google/fjccknnhdnkbanjilpjddjhmkghmachn), but it has been discontinued.

Apparently, this currently can't be done according to [this post](https://productforums.google.com/forum/#!topic/chrome/XJE1LBY76g8%5B1-25%5D) from a Google employee. Quote:

> Thank you all for your feedback. At this time, we don't have plans to implement this feature. Part of Chrome's design philosophy is to avoid interrupting you with annoying questions that only sometimes matter. Still, we do see how accidental closing of tabs can be frustrating, and we are thinking of a better solution. [...]

<sup>(The remainder of the post suggests the above obsolete extension and some workarounds on Mac)</sup>

However, there is another workaround posted by a Google user on [this post](https://productforums.google.com/forum/#!topic/chrome/XJE1LBY76g8%5B301-325%5D). That is basically to open a website that asks for confirmation before closing, and leave that page open or pinned.

[Here is the example website](http://www.maki-chan.de/preventclose.htm). I've tested it, and it works for me.

---
Note that [Firefox](https://www.mozilla.org/en-US/firefox/new/) has that feature by default. It may be worth switching if you use it much