Close the stream before aborting the program.