In order to avoid to have too many open files at a time, I included a line, which closes the open LUT file.