added a thread pool to export multiple patients simultaneously