Filechecker: smarter management of file descriptors

open a file once only, close appropriately