Slight memory fix in sphia_free

When destroying Sophia pointers, `db` must come first