Made the menu window auto free their memory when needed.

This will prevent future memory corruption, as seen and fixed in:
37f37cfa68bcbea80dde0550b57508545d106aa1