Issue with doc.close() not closing the document in PyMuPDF (original) (raw)

Description of the bug

Hello PyMuPDF community,

I am encountering an issue with PyMuPDF where a PDF file, once opened using fitz.open, does not close properly even after calling doc.close(). This is causing my Python script to not terminate as expected.

Steps to Reproduce:

  1. Open a PDF file using PyMuPDF: doc = fitz.open(pdf_path)
  2. Attempt to close the document: doc.close()
  3. Check if the document is closed: print(doc.is_closed)

Expected Behavior:
The doc.is_closed should return True after calling doc.close().

Actual Behavior:
The doc.is_closed returns False, indicating that the document remains open. As a result, my Python script does not terminate properly.

Environment:

Additional Information:

Any assistance in resolving this issue would be greatly appreciated. Thank you in advance for your help.

How to reproduce the bug

The bug can be reproduced following the code i have provided in my main message

PyMuPDF version

Built from source

Operating system

Linux

Python version

3.11