Fix ref leak in threadpool.c