Fix abnormal file io

Bug: 194697288
Test: calling streset at hal close
Change-Id: Ife64b2b6e93e985f1e6989554b3305afce56154e
diff --git a/st21nfc/adaptation/i2clayer.cc b/st21nfc/adaptation/i2clayer.cc
index c7b1300..33b54eb 100644
--- a/st21nfc/adaptation/i2clayer.cc
+++ b/st21nfc/adaptation/i2clayer.cc
@@ -88,7 +88,7 @@
   HALHANDLE hHAL = (HALHANDLE)arg;
   STLOG_HAL_D("echo thread started...\n");
   bool readOk = false;
-  int eventNum = (notifyResetRequest < 0) ? 2 : 3;
+  int eventNum = (notifyResetRequest <= 0) ? 2 : 3;
   bool reseting = false;
 
   do {
@@ -233,7 +233,9 @@
   close(fidI2c);
   close(cmdPipe[0]);
   close(cmdPipe[1]);
-  close(notifyResetRequest);
+  if (notifyResetRequest > 0) {
+    close(notifyResetRequest);
+  }
 
   HalDestroy(hHAL);
   STLOG_HAL_D("thread exit\n");