How to close the sensor connection