Problems burning bootloader using Arduino as ISP

I use an Arduino UNO as ISP for burning the bootloader on a custom 32u4 device, and while it eventually works and I've done several hundred this way, I'm constantly plagued by this message:

Using Port : COM12
Using Programmer : stk500v1
Overriding Baud Rate : 19200
avrdude: ser_open(): can't set com-state for "\.\COM12"

Sometimes unplugging the UNO will fix it, but usually I have to restart the IDE. It often works for one or two boards, and then I get this message again. Any suggestions?

Thanks!

What OS?

It looks like the com port isn’t being released by a previous process. What is the sequence of operations that leads to the fault?

This is on Windows 10. Usually I open the IDE, plug in the UNO (or vice versa), and am able to program one or two devices successfully, and then this problem occurs. Somehow, it seems that the problem has gotten more frequent over time, though I don’t see why that would be...