Updated sample code to handle close event and manually exit the current process. Some shells don't exit the process such as the WebStorm shell.
2.7.3