same logic in both closes.