Clean up memory used for unit test

Refs #5977