Fix socket leak when reading MAC data

Detected by a Coverity scan
Fix mismatched close

What gets opened by popen needs to be closed by pclose. Detected by a
Coverity Scan.