setNextRequest - won't stop on null

Hello

I run a collection that uses postman.setNextRequest() in a pre-req script to set the page id param value on my next request. This works fine until the last request in the collection where the if…else statement should stop when the nextPageId response is null. Instead, an additional request is made with the nextPageId set as null. Is there another way I should set my statement to stop this final request? Thanks

Request:
GET {{baseUrl}}users?pageId={{nextPageId}}

Pre-req script:
const nextPageId = pm.variables.get(‘nextPageId’);
if (nextPageId !== null) {
postman.setNextRequest(‘Users_nextPage’);
} else {
postman.setNextRequest(null);
}

Response
{
“limit”: 100,
“nextPageId”: null,
“content”:
}