unix: close signal pipe fds when last loop is done

Fixes #875.

Adds a leaked file descriptor check to the test runner that scans for open file descriptors when the test is done.  Most of the other commits are fix-ups that plug fd leaks in the tests.  I just noticed that the commit log that adds the check is a bit terse, I'll fix that up before landing this.

@indutny or @saghul, feel free to review it if you like.