Fixes resource leaks in unit-tests.

Signed-off-by: Garrett Wu <gwu@wibidata.com>