Add ->open to struct fio_file

Don't use ->fd == -1 to check for the file being open or not,
an io engine could be non-fd based.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/ioengines.c b/ioengines.c
index 9d7453b..c1648a0 100644
--- a/ioengines.c
+++ b/ioengines.c
@@ -261,6 +261,7 @@
 int td_io_open_file(struct thread_data *td, struct fio_file *f)
 {
 	if (!td->io_ops->open_file(td, f)) {
+		f->open = 1;
 		td->nr_open_files++;
 		return 0;
 	}
@@ -270,7 +271,10 @@
 
 void td_io_close_file(struct thread_data *td, struct fio_file *f)
 {
-	if (td->io_ops->close_file)
-		td->io_ops->close_file(td, f);
-	td->nr_open_files--;
+	if (f->open) {
+		if (td->io_ops->close_file)
+			td->io_ops->close_file(td, f);
+		td->nr_open_files--;
+		f->open = 0;
+	}
 }