Analytic solution of the two-body problem with slowly decreasing mass