Fix check for process terminating early