Fix a null pointer exception when killing a process at the same time it is being terminated