Fix a mutex leak in pack.c