reverted optim : do not remove children when closing a layer