* Electron version: 1.4.13
* Operating system: macOS

I am explaining the problem with a real world scenario so it is easier to understand.

There is no way to implement hot exit. By hot exit I mean - store the state of multiple windows when application quits so when started again the state could be restored. Hot exit shouldn't be turned on when a user is closing a window using the close button but instead a dialog asking if they want to save or disregard unsaved changes should appear.

For hot exit to work Electron should provide a mechanism to determine if `BrowserWindow` is being closed by the user or is being closed because the application is quitting. This seems easy at first because we could subscribe to `app.before-quit` event and raise a flag if the app is quitting.

```javascript
var quitting = false;
app.on('before-quit', function () {
  quitting = true;
});
browserWindow.on('close', function () {
  if (quitting) {
    // turn on hot exit and save window state 
  } else {
    // show dialog if there are any unsaved changes
  }
});
```

This works in the typical case but not if you want to restart the app(and for sure want to restore the state) after an update have been download. Calling `autoUpdater.quitAndInstall()` makes `before-quit` event called after the windows are closed and the above code starts failing.

There seems to be no way in Electron to properly determine if the app is quitting so you could perform an action in the `browserWindow.close` event.
atom/browser/api/atom_api_auto_updater.cc
const base::Time& val) {
    v8::MaybeLocal<v8::Value> date = v8::Date::New(
        isolate->GetCurrentContext(), val.ToJsTime());
    if (date.IsEmpty())
      return v8::Null(isolate);
    else
      return date.ToLocalChecked();
  }
};
}  
namespace atom {
namespace api {
AutoUpdater::AutoUpdater(v8::Isolate* isolate) {
  auto_updater::AutoUpdater::SetDelegate(this);
  Init(isolate);
}
AutoUpdater::~AutoUpdater() {
  auto_updater::AutoUpdater::SetDelegate(nullptr);
}
void AutoUpdater::OnError(const std::string& message) {