* Electron version: 1.4.14
* Operating system: Windows

Hi!
I faced with issue described in this two comments: 
https://github.com/electron/electron/issues/6388#issuecomment-236498471
https://github.com/electron/electron/issues/6388#issuecomment-244483403
The main issue is fixed, but the session is lost if the app is closed immediately after login and setting the cookie.

### Expected behavior
Cookie should be saved.

### Actual behavior
When the app is closed after less then 10-15 seconds a cookie is set, it is not saved when the app is reopened. 

atom/browser/api/atom_api_cookies.cc
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback);
}
void FilterCookies(std::unique_ptr<base::DictionaryValue> filter,
                   const Cookies::GetCallback& callback,
                   const net::CookieList& list) {
  net::CookieList result;
  for (const auto& cookie : list) {
    if (MatchesCookie(filter.get(), cookie))
      result.push_back(cookie);
  }
  RunCallbackInUI(base::Bind(callback, Cookies::SUCCESS, result));
}
void GetCookiesOnIO(scoped_refptr<net::URLRequestContextGetter> getter,
                    std::unique_ptr<base::DictionaryValue> filter,
                    const Cookies::GetCallback& callback) {
  std::string url;
  filter->GetString("url", &url);
  auto filtered_callback =
      base::Bind(FilterCookies, base::Passed(&filter), callback);
  
  if (url.empty())
    GetCookieStore(getter)->GetAllCookiesAsync(filtered_callback);
  else
    GetCookieStore(getter)->GetAllCookiesForURLAsync(GURL(url),
        filtered_callback);
}
void RemoveCookieOnIOThread(scoped_refptr<net::URLRequestContextGetter> getter,