Each opendevice() must eventually be matched by a call to closedevice(). All I/O requests must be complete before calling closedevice(). if any requests are still pending, abort them with abortio(). if (!(CheckIO(SCSIIO))) { AbortIO(SCSIIO); /* Ask device to abort any pending requests */ WaitIO(SCSIIO); /* Wait for abort, then clean up */ } CloseDevice(SCSIIO); /* Close SCSI device */