### Closing an Audit Trail File

The audit trail file must be closed using the dce_aud_close( ) function when the application shuts down (because of the rpc_mgmt_stop_server_listening( ) function call or other exceptional conditions). For example, to close the trail, the bank server's main program can make the following function call:

dce_aud_close(audit_trail, &status);

This function flushes buffered audit records to stable storage and releases the memory allocated for the trail descriptor.

##