def METHOD_NAME(list2, name):
    try:
        file = open(name, "w")
    except IOError as message:
        print("failed to open ", name, message)
        sys.exit(1)
    for b in list2:
        txt = b.generate_html()
        write_all_lines(file, txt)
    write_line(file, "</body>")
    write_line(file, "</html>")
    file.close()