need to unlock mutex before destroying it