changed ByteInstanceCounter class to write fragment to file instead of loading all fragments in memory first