Use finalizers to free C memory