In order to shut down a device, have a user-level application have it opened, and when it is sent SIGTERM by init (or, presumably, any other process), close the device or alert it of the shutdown in some other way.