[ogr] Only call repack when closing a data provider
Fix #8822