fix stale locks left behind when pthread_create fails