Always close the output stream in dump().