tracking down segfault on close