handle unplug case and exit program when done
infinite loop instead of collecting samples