Add trimming of empty chunks and empty region files