changed how the file streams closed