added a short waiting period, so that all threads have a chance to finish before resources are cleaned up.