Rewrite main() to reflect the final program flow
Create empty finalized file