Program looks for images when no more are returned

If the number of images returned by the search query < limit. The program will continue trying to get more URL's, running forever.