# QuickBooks closed unexpectedly
Source: https://www.desktopaccountingapi.com/docs/help/connection-errors/quickbooks-closed-unexpectedly/

> What to do when QuickBooks Desktop closed by itself while the app was using it and the connection stopped, even though the Web Connector is still open.

QuickBooks Desktop can close by itself (crash) while it is working on a request from the app. The Web Connector stays open, but it gets stuck and stops contacting the app, so the connection stops until you restart it.

## What you see

- QuickBooks is no longer open on the computer that runs it, although nobody closed it.
- The Web Connector window is still open, and **Auto-Run** is still checked for the app.
- The app says the connection is not active, or that QuickBooks Desktop probably closed unexpectedly.

If you open the Web Connector's log file (`QWCLog.txt`), its last lines repeat:

> Another update is already in progress. Please try again later.

## Why it happens

When QuickBooks closes in the middle of a request, the Web Connector reports the error ("Unexpected error", code `0x80040402`) and then waits for QuickBooks to answer. QuickBooks is gone, so it never does. The Web Connector keeps its update marked as running, and skips every later scheduled update. The app hears nothing from it, which looks the same as a closed Web Connector.

Starting the Web Connector again ends the stuck update. Opening QuickBooks first lets the next update find the company file.

## How to fix it

First make sure this is the problem, so you do not stop an update that is still working:

- QuickBooks Desktop is no longer open: it is not on the taskbar, and it did not just close because someone closed it.
- No other application in the Web Connector is updating: no other row shows a progress bar, and no other row's **Last run** is still changing. If one is, wait until it finishes and check again.

Then:

1. On the computer that runs QuickBooks, click **Exit** in the Web Connector window.
2. A window titled **QBWebConnector - Warning** asks:

   > There are scheduled jobs. Web Connector will not be able to run these jobs if you exit (Error code QBWC1020). Do you still want to exit?

   Click **Yes**.
3. Open QuickBooks Desktop and open the company file the app is connected to. Sign in as usual and close any window QuickBooks shows at start-up.
4. Open the Web Connector again from the Windows Start menu.

Do not remove the app from the Web Connector and do not add the connector file again. The app's row and its password stay as they are.

## How to check it worked

Within about 10 seconds the app's row in the Web Connector updates and shows no error in the **Status** column, and the app shows the connection as active again.

## If it happens again

A crash during the same action every time points to a problem in QuickBooks or in the company file. Note the time and what the app was doing, then:

- [Verify and repair the company file](https://www.desktopaccountingapi.com/docs/help/guides/repair-company-file/).
- Install the latest QuickBooks Desktop update.
- Contact the app's support with the time and the action. A request that was saving a change when QuickBooks closed may or may not have been saved, so check QuickBooks before you repeat it.

## Related pages

- [Connection not active](https://www.desktopaccountingapi.com/docs/help/connection-errors/connection-not-active/)
- [Another service is updating](https://www.desktopaccountingapi.com/docs/help/connection-errors/another-update-in-progress/)
- [The Web Connector warns about scheduled jobs when you exit](https://www.desktopaccountingapi.com/docs/help/connection-errors/connection-not-active/#the-web-connector-warns-about-scheduled-jobs-when-you-exit)

For developers, see the [`quickbooks_closed_unexpectedly`](https://www.desktopaccountingapi.com/docs/troubleshooting/#quickbooks_closed_unexpectedly) diagnosis cause and [`QBD_READ_INTERRUPTED`](https://www.desktopaccountingapi.com/docs/errors/#qbd_read_interrupted).
