FD leak fixes

Several FDs were not being closed, some due to an issue on Ruby 1.8.7 (https://bugs.ruby-lang.org/issues/5041).  This is visible with lsof while r10k is running for a reasonably long Puppetfile.

(relates to #174)