fix thread and shm cleanup in the cancellation point test