Fixes execProcesses wait order. Refs #379.

Closing the stream of the process might terminate it too early for
waitForExit to gather any useful results.
Merge pull request #639 from gradha/pr_fixes_execProcesses

Fixes execProcesses wait order. Refs #379.