I usually end up with a lot of empty desktop/spaces upon disconnecting external monitors.
Is there an easy way to close all desktop/spaces that don't have any application windows on them?
Aside from the usual way, going into Mission Control and closing each individual Space, I don't believe so. You can speed this up and hold the option key down and this will keep the (x) to close the Desktops shown so you don't have to hover over the selected Desktop and wait for it to show itself.
The only way that I would think you might be able close them all at once without performing the above process is probably with an Automator script or AppleScript.