Make count correctly handle file object for gzipping