Fixed #22710 -- Documented aggregation behavior for empty QuerySets.

Thanks matklad for the report.
Improved the test for refs #22682.

Thanks apollo13 for the review.
Fixed #19905 -- Fixed leakage of file descriptors in form wizard.