fixing memoryleak by introducing a nonehandle

In CreateProcess the non functional thread
handle was leaked.
changed processhandle handling to new system
fixed win32 build
fixed compiler warning
Merge pull request #2244 from MartinHaimberger/mh-improveHandleHandling

improve handle handling and fix memory leak