Limit the number of threads closing a resource.