Fix memory leak: should free the entities (alongside with the shapes, the
bodies) on shutdown