Update tpb.py

check if page is last