Después de haberla terminado, se fue a la cama.

English Translation

Having finished it, he went to bed.

Why would this be haberla rather than haberlo?

We don’t know what ‘it’ is. It could be feminine, like ‘la novela’ or ‘la botella’.