Continuation of Fix for [CEF 2171] Crash on quit(https://github.com/adobe/brackets/issues/7683)

This change involves some code changes got from code review comments
from (https://github.com/adobe/brackets-shell/pull/487) pull request.