title: How to capture a command prompt window close event in python
body: <p>I want to capture command window close event from Python.<br>
  In other words, when the user tries to close the command prompt window, script should detect it and display a message like <code>Do you really want to exit - Yes/No</code></p>
  
  <p>Any suggestions about how to implement this?
  Please help me in doing this.</p>