SONARPLUGINS-2158 Fix file descriptor leak