Now closing files properly.