fclose() function closes the file
int fclose (int filepointer) <? $file = "data.txt"; if (file_exists($file)) : $fh = fopen($file, "r"); fclose($fh); else: print "File $file does not exist!"; endif; ?>