# QuickBooks says the company file is being used by another application
Source: https://www.desktopaccountingapi.com/docs/help/connection-errors/company-file-in-use/

> Fix "The company file cannot be closed at this time because there is another application (… via Desktop Accounting API) which is using it" when you close the company, exit QuickBooks or restore a backup.

QuickBooks will not close the company file, exit or restore a backup while a connected app is still talking to it. Usually the app finishes within seconds and the message clears by itself. When it does not, the usual cause is a Web Connector that stopped partway through an update. This page covers both cases.

## What you see

When you choose **File › Close Company**, exit QuickBooks or start a restore, QuickBooks shows:

> The company file cannot be closed at this time because there is another application (_App name_ via Desktop Accounting API) which is using it. Before you can close the company file you must either close that application or instruct the application to end its session with QuickBooks.

_App name_ is the name of the app that sent you the setup link.

## Why it happens

The Web Connector passes the app's requests to QuickBooks in short sessions. While a session is open, QuickBooks counts the app as using the company file, the same as a person working in it.

- **The app just finished a request.** The session closes about 2 seconds after the app's last request. If the app is working through a list page by page, it stays open for up to 10 seconds after the last page.
- **The app is in the middle of a large job.** One session lasts at most 2 minutes. Then it closes, even if the app has more work queued.
- **The Web Connector stopped during an update.** If the Web Connector closes or crashes while an update is running, QuickBooks can keep the session open on its own for several minutes. In our tests on Windows 10 with QuickBooks Enterprise 24, it let go of the file 6 minutes after we ended a stuck Web Connector, and 11 minutes 36 seconds after the Web Connector crashed. Other computers can take longer.
- **Exit was chosen in the Web Connector during an update.** Choosing **File › Exit** while an update is running can leave the Web Connector stuck partway through closing. It stays in Task Manager, and QuickBooks keeps refusing until you end it.

## How to fix it

Work through these steps in order. Stop as soon as **File › Close Company** works.

1. **Wait 15 seconds, then try again.** Most of the time the session has closed by then.
2. **If the app is in the middle of a large job, wait up to 2 minutes and 15 seconds,** then try again. While an update is running, the app's row in the Web Connector shows its progress.
3. **Pause the app, then close the Web Connector.** In the Web Connector, uncheck **Auto-Run** for the app. Wait until the app's row shows no update running, then wait 15 more seconds. Choose **File › Exit** in the Web Connector, then try **Close Company** again. Do not choose **Exit** while an update is still running.
4. **If the Web Connector does not close within a minute after Exit,** it is stuck. Open Task Manager (**Ctrl+Shift+Esc**), select **QuickBooks Web Connector** (`QBWebConnector.exe`), and choose **End task**. End only the Web Connector, never QuickBooks.
5. **Wait up to 15 minutes, trying Close Company every few minutes.** After the Web Connector stops partway through an update, QuickBooks lets go of the file by itself. Keep QuickBooks open and save any work you have open in it.
6. **If QuickBooks still refuses after 15 minutes,** save your work, then restart the computer. Restarting ends every program that still has a session open.
7. **Start the Web Connector again** from the Start menu once you are finished, and check **Auto-Run** for the app again. The app cannot reach QuickBooks until you do.

Never end QuickBooks (`QBW.EXE` or `QBW32.EXE`) in Task Manager. It may be writing to the company file, and ending it can damage the file.

## How to avoid it

- Before you close the company file, exit QuickBooks or restore a backup, uncheck **Auto-Run** for the app in the Web Connector and wait 15 seconds. Check it again when you are done.
- Close the Web Connector only while no update is running.
- Do not end the Web Connector in Task Manager while it shows an update in progress, unless it is stuck as described in step 4.

## How to check it worked

**File › Close Company** closes the file without the message. After you start the Web Connector again and check **Auto-Run**, the app's row updates within about 10 seconds and shows no error in **Last Result**.

## When to contact the app's support

Contact them if QuickBooks still refuses after a restart, or if the message comes back often while nobody has closed the Web Connector. Send the time you saw the message, the exact text, whether you chose **Exit** in the Web Connector, and the Web Connector log file, `C:\ProgramData\Intuit\QBWebConnector\log\QWCLog.txt`.

## Related pages

- [Another update is in progress](https://www.desktopaccountingapi.com/docs/help/connection-errors/another-update-in-progress/)
- [Single-user or multi-user mode conflict](https://www.desktopaccountingapi.com/docs/help/connection-errors/single-user-multi-user/)
- [Fix a moved, renamed or restored company file](https://www.desktopaccountingapi.com/docs/help/guides/moved-or-renamed-file/)
- [Start QuickBooks and the Web Connector at sign-in](https://www.desktopaccountingapi.com/docs/help/guides/start-automatically/)

For developers, see [Request lifecycle](https://www.desktopaccountingapi.com/docs/guides/request-lifecycle/#how-long-requests-take).
