modified.

modified for closing the stream and exporter.