title: Spark: ERROR LiveListenerBus: Listener EventLoggingListener threw an exception
body: <p>I executed a spark program in which I am applying Drools rules on fact object using customer framework. I am calling this custom framework with in Flatmap function and rule was executed successfully but after collecting the result I saw the below exception. 
      Has anyone faced the same issue ? How can I fix this error ? Please help me on this issue.</p>
  
  <pre><code>15/09/18 10:45:34 INFO JDBCRDD: closed connection
  15/09/18 10:45:34 INFO Executor: Finished task 0.0 in stage 0.0 (TID 0). 599 bytes result sent to driver
  15/09/18 10:45:34 INFO TaskSetManager: Finished task 0.0 in stage 0.0 (TID 0) in 3405 ms on localhost (1/1)
  15/09/18 10:45:34 INFO TaskSchedulerImpl: Removed TaskSet 0.0, whose tasks have all completed, from pool
  15/09/18 10:45:34 INFO DAGScheduler: Stage 0 (collect at SMAAlertImpl.java:84) finished in 3.425 s
  15/09/18 10:45:34 INFO DAGScheduler: Job 0 finished: collect at SMAAlertImpl.java:84, took 3.719422 s
  15/09/18 10:45:35 ERROR LiveListenerBus: Listener EventLoggingListener threw an exception
  java.lang.reflect.InvocationTargetException
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:497)
          at org.apache.spark.scheduler.EventLoggingListener$$anonfun$logEvent$3.apply(EventLoggingListener.scala:144)
          at org.apache.spark.scheduler.EventLoggingListener$$anonfun$logEvent$3.apply(EventLoggingListener.scala:144)
          at scala.Option.foreach(Option.scala:236)
          at org.apache.spark.scheduler.EventLoggingListener.logEvent(EventLoggingListener.scala:144)
          at org.apache.spark.scheduler.EventLoggingListener.onStageCompleted(EventLoggingListener.scala:165)
          at org.apache.spark.scheduler.SparkListenerBus$class.onPostEvent(SparkListenerBus.scala:32)
          at org.apache.spark.scheduler.LiveListenerBus.onPostEvent(LiveListenerBus.scala:31)
          at org.apache.spark.scheduler.LiveListenerBus.onPostEvent(LiveListenerBus.scala:31)
          at org.apache.spark.util.ListenerBus$class.postToAll(ListenerBus.scala:53)
          at org.apache.spark.util.AsynchronousListenerBus.postToAll(AsynchronousListenerBus.scala:36)
          at org.apache.spark.util.AsynchronousListenerBus$$anon$1$$anonfun$run$1.apply$mcV$sp(AsynchronousListenerBus.scala:76)
          at org.apache.spark.util.AsynchronousListenerBus$$anon$1$$anonfun$run$1.apply(AsynchronousListenerBus.scala:61)
          at org.apache.spark.util.AsynchronousListenerBus$$anon$1$$anonfun$run$1.apply(AsynchronousListenerBus.scala:61)
          at org.apache.spark.util.Utils$.logUncaughtExceptions(Utils.scala:1617)
          at org.apache.spark.util.AsynchronousListenerBus$$anon$1.run(AsynchronousListenerBus.scala:60)
  Caused by: java.io.IOException: Filesystem closed
          at org.apache.hadoop.hdfs.DFSClient.checkOpen(DFSClient.java:792)
          at org.apache.hadoop.hdfs.DFSOutputStream.flushOrSync(DFSOutputStream.java:1998)
          at org.apache.hadoop.hdfs.DFSOutputStream.hflush(DFSOutputStream.java:1959)
          at org.apache.hadoop.fs.FSDataOutputStream.hflush(FSDataOutputStream.java:130)
          ... 19 more
  15/09/18 10:45:35 ERROR LiveListenerBus: Listener EventLoggingListener threw an exception
  java.lang.reflect.InvocationTargetException
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:497)
          at org.apache.spark.scheduler.EventLoggingListener$$anonfun$logEvent$3.apply(EventLoggingListener.scala:144)
          at org.apache.spark.scheduler.EventLoggingListener$$anonfun$logEvent$3.apply(EventLoggingListener.scala:144)
          at scala.Option.foreach(Option.scala:236)
          at org.apache.spark.scheduler.EventLoggingListener.logEvent(EventLoggingListener.scala:144)
          at org.apache.spark.scheduler.EventLoggingListener.onJobEnd(EventLoggingListener.scala:169)
          at org.apache.spark.scheduler.SparkListenerBus$class.onPostEvent(SparkListenerBus.scala:36)
          at org.apache.spark.scheduler.LiveListenerBus.onPostEvent(LiveListenerBus.scala:31)
          at org.apache.spark.scheduler.LiveListenerBus.onPostEvent(LiveListenerBus.scala:31)
          at org.apache.spark.util.ListenerBus$class.postToAll(ListenerBus.scala:53)
          at org.apache.spark.util.AsynchronousListenerBus.postToAll(AsynchronousListenerBus.scala:36)
          at org.apache.spark.util.AsynchronousListenerBus$$anon$1$$anonfun$run$1.apply$mcV$sp(AsynchronousListenerBus.scala:76)
          at org.apache.spark.util.AsynchronousListenerBus$$anon$1$$anonfun$run$1.apply(AsynchronousListenerBus.scala:61)
          at org.apache.spark.util.AsynchronousListenerBus$$anon$1$$anonfun$run$1.apply(AsynchronousListenerBus.scala:61)
          at org.apache.spark.util.Utils$.logUncaughtExceptions(Utils.scala:1617)
          at org.apache.spark.util.AsynchronousListenerBus$$anon$1.run(AsynchronousListenerBus.scala:60)
  Caused by: java.io.IOException: Filesystem closed
          at org.apache.hadoop.hdfs.DFSClient.checkOpen(DFSClient.java:792)
          at org.apache.hadoop.hdfs.DFSOutputStream.flushOrSync(DFSOutputStream.java:1998)
          at org.apache.hadoop.hdfs.DFSOutputStream.hflush(DFSOutputStream.java:1959)
          at org.apache.hadoop.fs.FSDataOutputStream.hflush(FSDataOutputStream.java:130)
          ... 19 more
  </code></pre>