Make sure files are closed after reading.