When an Agent object is created as a non-pointer object, i.e.,:
as opposed to:
Agent* agent = new Agent(...)
If shutdown() is called within the Agent object, then when the scope containing the agent object is left and it is destroyed, then the destructor will also call shutdown() and cause internal pointers to be freed again, resulting in error messages like this:
[0.009] Shutting down Agent. Last error: Open
free(): double free detected in tcache 2