Changed to use a buffered HDFS writer to avoid race conditions