lint: wait for thread finish when terminating