[1.7.x] Fixed #22710 -- Documented aggregation behavior for empty QuerySets.

Thanks matklad for the report.

Backport of 7c6e96ec1f from master
[1.7.x] Improved the test for refs #22682.

Thanks apollo13 for the review.

Backport of 6f4d7f41b1 from master
[1.7.x] Fixed #19905 -- Fixed leakage of file descriptors in form wizard.

Backport of c4c2c99669ef9d58306856c47058b121bbecfe5f from master.
[1.7.x] Fixed #22299 -- Cleanup wizard temp files when possible.

Thanks to @erikr for the review.

Backport of fa8b4735287c92b03d23823de8a4e1168d1951d9 from master.