fixing infinite loop bug and some scenario changes

strange behavior in Process#waitFor native code on Windows when
processes crash