close file after reading header