RMX-1505 wait for the process to exit before trying to retrieve the exit code

Processes have a STDOUT and a STDERR, and we seemed to be seeing a process with both its STDOUT and STDERR streams closed still running.  When retrieving the exit code of the process it was causing an error and never reporting the fact the process had exited.
Merge pull request #1 from formicary/RMX-1505_WaitForProcessExit

RMX-1505 wait for the process to exit before trying to retrieve the exit code