Semaphore Can't Be Closed (0x00000066): The Real Fixes
Windows says the semaphore is set and can't close. Usually a stuck app or driver. Here's how to kill it and move on.
Cause #1: A Stuck Process Still Holds the Semaphore Handle
This is the most common reason you see ERROR_SEM_IS_SET (0x00000066) — something is still using the semaphore and won't let go. Usually it's a program that crashed but left its handle open. Had a client last month whose print queue died because of this: a print spooler service got wedged and any attempt to stop it threw this error.
Here's the fix. Open Task Manager (Ctrl+Shift+Esc). Go to the Details tab. Sort by CPU or memory to find the culprit. Look for the app that's associated with the semaphore. If you don't know which one, look at what you were doing when the error appeared — printing, scanning, using a USB device, running a specific app.
Right-click the process and choose End task. If it won't die, you need to force it with the command line. Open an admin Command Prompt and run:
taskkill /f /im processname.exe
Swap processname.exe with the actual process name, like spoolsv.exe for the print spooler. The /f flag forces termination. If the process is a system service, you might need to stop the service instead:
net stop spooler /y
If that still fails with the same error, you're dealing with a deeper lock. Move to the next cause.
Cause #2: A Kernel Driver or Antivirus Is Blocking the Close
I've seen this mostly with old printer drivers and security software. The driver registers a callback or filter that intercepts the close call and returns STATUS_SEMAPHORE_LIMIT_EXCEEDED (that's the internal NT status for this). Real scenario: a client had a cheap all-in-one printer driver that hooked into the print pipeline. After an update, the semaphore wouldn't close. The fix? Remove the driver entirely.
Open Device Manager. Find the device (probably under Print queues or Imaging devices). Right-click, select Properties, go to the Driver tab. Click Uninstall device and check Delete the driver software for this device. Reboot, then install the latest driver from the manufacturer's site — not Windows Update.
For antivirus, temporarily disable real-time protection. If the error goes away, whitelist the affected app or update your AV. Windows Defender rarely causes this; third-party ones like McAfee or Norton sometimes do.
Cause #3: File or Registry Handle Corruption (Rare but Real)
This one's a pain. The semaphore handle itself gets corrupted — maybe from a disk error, a power loss, or a buggy driver. You'll see this when trying to close a handle to a file or registry key that's already been deleted or is in an inconsistent state.
First, run chkdsk /f on the drive. Open an admin Command Prompt and type:
chkdsk c: /f
Schedule it for next boot, then restart. Let it scan and fix. If that doesn't help, try SFC /scannow to check system files. If both come clean, the corruption might be in the registry — but that's a last resort. Create a system restore point first, then use regedit to search for the offending key. Honestly, I'd just back up data and reinstall Windows if it's that deep. Not worth the time.
When All Else Fails: Reboot, Then Clean Boot
If none of the above works, shut down normally (don't force power off). Pull the power cord for 30 seconds if it's a desktop — that clears hardware locks. Boot into Safe Mode by holding Shift while clicking Restart in the login screen, then selecting Troubleshoot > Advanced options > Startup Settings > Restart, then press 4 for Safe Mode. If the error doesn't appear in Safe Mode, it's a third-party driver or service. Use msconfig to do a clean boot and isolate the culprit.
Quick-Reference Summary Table
| Cause | Symptom | Fix |
|---|---|---|
| Stuck process holding handle | Error appears when closing an app or service | Taskkill /f or net stop |
| Kernel driver or AV blocking close | Error with specific hardware or software | Uninstall driver, disable AV |
| File/registry handle corruption | Error after crash or power loss | chkdsk /f, SFC, or clean install |
I've fixed this error dozens of times. Nine times out of ten, it's a stuck process. Don't waste hours — kill the process, reboot, move on.
Was this solution helpful?