segfault at closing