pmcstudy: fix error handling
Close file descriptor in the correct way if no counters are built into the application.
Obtained from: Stormshield