stop using file handles

it makes caching harder