Fix possible use after free in ipc.m & kill the closure