Firefox icon remains in the Dock after quitting

Right click the icon in the Dock > Options

If it's running you'll see "Keep in Dock" which you need to uncheck
if it's not running, instead you'll see "Remove from Dock"

Both do the same thing, remove it from the Dock when it's not running.

enter image description here

enter image description here

The third method is to grab the icon in the Dock & drag it out into an empty area of your desktop, then release…

enter image description here