In Firefox's menu bar, go to "Tools" and click "Options...".
In the Options window, go to the "Privacy" tab.
In the "Private Data" section at the bottom of the window, click "Settings...".
From there, you can customize what Firefox should clean out.
For example, to clear your browser history, check the box next to "Browser History".
To keep your passwords, uncheck "Saved Passwords".
If you do not want to have something cleared, just uncheck it.
After you have adjusted what you want Firefox to delete or keep, click "OK".
Back in the Options window, check the box next to "Always clear my private data when I close Firefox".
Now, every time Firefox closes, it will clean out only what you want it to.