"Why do applications 'accumulate' memory yet not clear it when windows are closed? "
Badly written applications - a running application will request a memory allocation, use it and should then deallocate it when done.
Failure to deallocate (and an app like FF may have many threads that are constantly asking for memory, using it and releasing it) leads to a "memory leak" - more and more memory allocated but not released, until things slow down to a crawl or crash.
Having said that, in languages like C and C++ which do not have automatic "garbage collection" it is easy to miss or fail a memory deallocation unless you are testing very rigorously.
Earlier versions of FF were notorious for memory leaks but it is now pretty good - upgrade to a newer version.
See
Memory leak - Wikipedia, the free encyclopedia
Mac