Fixed ping thread to have cleaner exit handling