Fix Tests resource leaks.

/CC @niksedk @alfaproject: please confirm you don't get any failed tests locally too.