Fixed a few ResourceWarning in the test suite. Refs #22680.