Fix extra pages in PDF of big books (BL-561)

On Linux the PDF of big books had extra pages for the front matters.
A similar fix as for BL-390 is needed in this case as well.
Merge pull request #165 from ermshiperete/BL-561

Fix extra pages in PDF of big books (BL-561)