Hopefully this fixes too many open files error

fixes issue #28