Compositional evolution with mass transfer in closed systems