def end_file(current_output):
    """End an output file.
    This is smart enough to do nothing if current_output is None.
    @param current_output: the current file output (or None).
    @returns: None, to represent the closed stream.
    """
    if current_output:
        # write the iati-activities end tag
        current_output.write("</iati-activities>\n")
        # close the output
        current_output.close()
    return None