def round_fracs(amts):
    """
    Rounds array, ensuring that sum(result) == sum(amts)
    Using even-rounding (rounds to the nearest even for 0.5)
    All fractions are closed (accumulated) to last element.
    """
    if len(amts) == 0:
        return []
    if len(amts) == 1:
        return [round(amts[0])]
    first = [round(amt) for amt in amts[:-1]]
    return first + [int(sum(amts) - sum(first))]