def header_slit(input_file, output_base, output_size, extension='.smi'):
    """Splits the lines in an input file (including a header)
    into a series of output files.

    :param input_file: The input file
    :type input_file: ``str``
    :param output_base: The basename of the output files. The files are written
                        to the current working directory with a numerical
                        suffix and .smi. If the base is `x` the first output
                        file will be named `x_1[extension]`.
    :type output_base: ``str``
    :param output_size: The number of lines in each output file.
    :type output_size: ``int``
    :param extension: The extension for the output files.
    :type extension: ``str``
    """
    with open(input_file) as smiles_file:
        smiles_file.seek(0, 0)
        header = smiles_file.readline()
        file_line_count = 0
        file_number = 1
        output_file = None
        line = smiles_file.readline()
        while line and line.strip():
            if file_line_count == 0:
                name = output_base + '_' + str(file_number) + extension
                output_file = open(name, 'w')
                output_file.write(header)
                file_line_count = 0
            output_file.write(line)
            file_line_count += 1
            if file_line_count == output_size:
                output_file.close()
                output_file = None
                file_line_count = 0
                file_number += 1
            line = smiles_file.readline()
        if output_file:
            output_file.close()
