Firefox flatpak and url links

I am using the Firefox flatpak from the fedora repository.

However I have noticed that in some cases when I click links, e.g. from KeepassXC, I get the following message:

Firefox is already running, but is not responding. To use Firefox, you must first close the existing Firefox process, restart your device, or use a different profile.

Any ideas why this may be happening?

Another way to reproduce this issue is to run the following code:

import os, webbrowser, sys
from urllib.request import pathname2url
#"file://" + pathname2url(os.path.abspath(sys.argv[1])))"/home/$USER/Downloads/test.html")

Make sure to create a test.html file with a text editor and add your user name in the string above. The commented out line is the original line from a python package’s Makefile.

Before I migrated from the firefox rpm package to the firefox fedora flatpak those things were working fine. Any ideas on how to fix them?