If the above doesn't work it might be a addon.
1. Right click on your task bar (down the bottom of your screen where all open programs appear) then click Start Task Manager.
2. Click the processes tab and the find in the list firefox.exe. Click on firefox.exe and then click end process. You can now close task manager.
3. The best way to test this is start Firefox in safemode. To do this right click on your Firefox shorcut (Most likley on the desktop) and then click Properties. The Firefox properties window should open up.
4. On the shortcut tab in the target field at the end after the quotes add -safe-mode then click OK.
5. Now double click on the Firefox shortcut you just changed.
6. A Firefox safe mode window should open. Click continue in safe mode. (This will disable all addons and plugins)
7. Now test this a few times to see if Firefox closes properly. If it does when starting in safe mode click diable all add-ons. This will permanently disable your add-ons even when not running Firefox in safe mode.
8. Remove the -safe-mode from the shortcut target field and then start Firefox again. Test again to see if Firefox closes. If it does inable addons one by one to find the one that is coursing this problem.
This this doesn't work it might be a toxic profile.