Resource Leaks cleanup

Our Jenkins installation still suffers from resource leaks on big uptimes.
This fix targets high-impact resource leaks discovered by [Coverity Scan][1]

[1]: https://scan.coverity.com/projects/94

For the future please avoid making whitespace-only changes (here, adding trailing WS).