Ensure we call CloseServiceHandle() in case of errors.