Added missing close method calls for open files

In pylint and pep8 tasks.