Documentimport:fix memory leaks