NetCharDevControl or Net32CharDevControl

The NetCharDevControl API forces a serial device closed.

Normally, a serial device is closed with a call to the DosClose function. If an opened device cannot be closed with DosClose, NetCharDevControl can be called to force the device closed.