implement pagination-aware shutdown