Each OpenDevice() must eventually be matched by a call to CloseDevice(). All I/O requests must be complete before CloseDevice(). If any requests are still pending, abort them with AbortIO(). if (!(CheckIO(TimerIO))) { AbortIO(TimerIO); /* Ask device to abort any pending requests */ } WaitIO(TimerIO); /* Clean up */ CloseDevice((struct IORequest *)TimerIO); /* Close Timer device */