If it takes too long for a program to shutdown gracefully, the OS eventually pulls the plug. Some people have complained that Firefox is slow when using the Flatpak version.
Does this happen even when you close Firefox first, and then shutdown your system? Are there any other signs that Firefox is slow?