Closed
Description
Unlike Unix, Windows doesn't have a "zombie" state where the pid remains valid in a zombie state after the subprocess has exited. The numeric process ID becomes invalid immediately once the process has exited.
On Windows, instead of closing/discarding the process HANDLE immediately after CreateProcess returns, it should be retained in Execution and only closed once monitorProcessTermination returns. Otherwise, the period between which the original HANDLE returned from CreateProcessW is closed and OpenProcess is subsequently called to regain the handle from the system using the numeric pid is subject to race conditions.