Fixed exceptions when closing AppendingTiffWriter by radarhere · Pull Request #8723 · python-pillow/Pillow

Tests/test_file_tiff.py::TestFileTiff::test_appending_tiff_writer_writelong
  /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/unraisableexception.py:85: PytestUnraisableExceptionWarning: Exception ignored in: <PIL.TiffImagePlugin.AppendingTiffWriter object at 0x114c785e0>
  
  Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/PIL/TiffImagePlugin.py", line 2212, in close
      self.finalize()
      ~~~~~~~~~~~~~^^
    File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/PIL/TiffImagePlugin.py", line 2082, in finalize
      raise RuntimeError(msg)
  RuntimeError: IIMM of new page doesn't match IIMM of first page
  
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

Tests/test_file_tiff.py::TestFileTiff::test_appending_tiff_writer_rewritelastshorttolong
  /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/unraisableexception.py:85: PytestUnraisableExceptionWarning: Exception ignored in: <PIL.TiffImagePlugin.AppendingTiffWriter object at 0x114c7ade0>
  
  Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/PIL/TiffImagePlugin.py", line 2212, in close
      self.finalize()
      ~~~~~~~~~~~~~^^
    File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/PIL/TiffImagePlugin.py", line 2082, in finalize
      raise RuntimeError(msg)
  RuntimeError: IIMM of new page doesn't match IIMM of first page
  
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

These exceptions are occurred when AppendingTiffWriter is being closed at the end of the test method.