Closing sensor on program exit