Force a GC when shutting down each layout task. Fixes #2342.