sensor_ranges_driver: improve shutdown and error handling