Handle closeAll and fix a closeAll/saveAll bug in which the working set was modified during iteration.