Fixed files not being closed.