When an application and/or process has completed operations with the database, it must release resources by closing the open files and disconnecting from the database engine.
Below is the code for Done():
/*
* Done()
*
* This function handles the housekeeping of closing tables and
* freeing of associated memory
*/
#ifdef PROTOTYPE
VOID Done(VOID)
#else
VOID Done()
#endif
{
COUNT retval;
printf("DONE\n");
/* close table (optional) */
printf("\tClose table...\n");
retval = CloseRFile(custmast_filno);
if (retval != NO_ERROR)
Handle_Error("Done(): CloseIFile()", 0);
/* logout and free memory */
printf("\tLogout...\n");
CloseISAM();
#ifdef ctThrds
ctThrdTerm();
#endif
}