Prevent busy loop during ECL interpreter shutdown on Cygwin.

See https://trac.sagemath.org/ticket/22337
diff --git a/src/c/file.d b/src/c/file.d
index 2285a60..aeed899 100755
--- a/src/c/file.d
+++ b/src/c/file.d
@@ -5317,7 +5317,7 @@ static int
 flisten(cl_object stream, FILE *fp)
 {
         int aux;
-        if (feof(fp))
+        if (feof(fp) || ferror(fp))
                 return ECL_LISTEN_EOF;
 #ifdef FILE_CNT
         if (FILE_CNT(fp) > 0)
