void TIFFClose(TIFF *tif)
TIFFClose closes a file that was previously opened with TIFFOpen(3TIFF). Any buffered data are flushed to the file, including the contents of the current directory (if modified); and all resources are reclaimed.
All error messages are directed to the TIFFError(3TIFF) routine. Likewise, warning messages are directed to the TIFFWarning(3TIFF) routine.
Libtiff library home page: http://www.simplesystems.org/libtiff/