Fixed issue with calculating the amount of empty slots in the end of file required to match groupedBy value