Unlock mutex only after lock