Add a base class for FD-relevant tests

The base class will fail any test cases that leak FDs or threads.