Made sure files are closed and did some linting