Fix intermittent core on exit