add a bit of efficiency by reusing an opened file handle