fixing thread pool shutdown issue