notebook creation and closing