Close input and output file handles.