made sure to close input and output files