Fix crash in pdf generator
There is a theoretical chance that doCloseDocument has been called while text extraction is running. There has at least been unit test crashes here. Try guard that case.
There is a theoretical chance that doCloseDocument has been called while text extraction is running. There has at least been unit test crashes here. Try guard that case.