private static bool IsHandleInvalid(SafeFileHandle handle) { return handle == null || handle.IsInvalid || handle.IsClosed; }