Fixed the memory leaks AGAIN, moved destroy_data_structs into shutdown RPC.