add code to close output and input streams/file.