cs: Fix leaked pthreads