Changed the destructor functions for abstract types to change the pointer of the object to NULL, eliminating possible dangling pointers after freeing