fixed file closing in edge creation bug