fix segfault while closing notebook