Check if device is open before shutting it off.