Fix a notebook close issue