Added cleanup handler and process managing for Windows to make sure all handle will be closed.