Details
Description
The reason is that QPdfDocument::load() creates a QFile each time. When it detects that it needs a password, it has to try again after the password is provided; at that time, QFile::open() fails, probably because Windows doesn't allow opening a file that's already open. So we have to be more careful about closing it and disposing the QFile if we're going to re-open it later, or else reuse the existing QFile instance perhaps.
Found by investigating test failures in https://codereview.qt-project.org/c/qt/qtwebengine/+/399780