[tests] show more output on console with --debug
Fix filedescriptor/socket leaking