Make sure files are closed when no longer used.