Alternatively, you could be trying to use a process id which does not exist, or which your operating system no longer recognizes.
Resolution:
You should close some of the indexed files which you are no longer accessing, and you should then be able to open the file you require.
In this case you must rewrite your code so that it uses a process id which your system recognizes.