Catch if files are not writable to output

Change-Id: I54e5cb0252de8bb4c500e4ebbcb454b722803d0e
diff --git a/lib/KorAP/XML/Batch/File.pm b/lib/KorAP/XML/Batch/File.pm
index 01a7cd1..02d0bc8 100644
--- a/lib/KorAP/XML/Batch/File.pm
+++ b/lib/KorAP/XML/Batch/File.pm
@@ -88,6 +88,13 @@
     }
     else {
       $file = IO::File->new($output, "w"); # '>:encoding(UTF-8)'); # "w");
+      # Unable to open for writing
+    };
+
+    # Output not opened
+    unless (defined $file) {
+      $self->{log}->error('Unable to open ' . $output . ' for writing');
+      return;
     };
 
     # Write to output