I'm not sure why it stopped at page 40 , may you need to check your log file for figure out the exact cause. I've some proposals as follow:
1) You can try to set 'Max. retries' = 3 for page navigation template in advanced tab > action section, thus, if it fails at specific page due to internet connection or other unexpected issue, it will attempt to load current page for 3 times.
2) A simply way is that you change start url from last broken page, see below:
the parameter 'page=40' indicates that it will start from page 40.