Fix file creation so that output is correct size.