Close MAMA and free all associated resource. MAMA employs a reference count to track multiple calls to Mama.open() and Mama.close(). The count is incremented every time Mama.open() is called and decremented when Mama.close() is called. The resources are not actually released until the count reaches zero. This function is thread safe.