I have a very strange problem. I have a script written in python which is generating an html report then I convert it using pdfkit to pdf . The script is working just fine on MAC and the pdf is generated normally. When I tried to install the same script on Ubuntu I got the following upnormal behavior:

The html file is fully generated 
The pdf file is generated but without the last 2 pages

when I tried to convert the either through wkhtmlto pdf command or through the python (outside the script) I got the right PDF form. Any idea why I'm examining this behavior ?
I found the solution. The problem was that I didn't close .colse() the file before the initialisation of the pdfkit
PDFKit with python on Ubuntu