private static void _CloseDevice(IntPtr handle) { if (Environment.OSVersion.Version.Major > 5) { NativeInterface.CancelIoEx(handle, IntPtr.Zero); } NativeInterface.CloseHandle(handle); }