fixes path closing bug