Each opendevice() must eventually be matched by a call to closedevice().
When the last close is performed, the device will deallocate all resources
and buffers. The latest parameter settings will be saved for the next
open.
All I/O requests must be complete before closedevice(). if any requests
are still pending, abort them with AbortIO():
if (!(CheckIO(ParallelIO)))
{
AbortIO(ParallelIO); /* Ask device to abort request, if pending */
}
WaitIO(ParallelIO); /* Wait for abort, then clean up */
CloseDevice((struct IORequest *)ParallelIO);