Added clean-up code in the destructors for Vertex and Grid