Implement well-defined behavior for closing