Fix memory leak in JavaExporter