Hi there,
According to the Chicago Manual of Style,
A dependent clause that follows a main clause should not be preceded by a comma if it is restrictive, that is, essential to the meaning of the main clause. If it is merely supplementary or parenthetical, it should be preceded by a comma. (Note that the distinction is occasionally tenuous; if in doubt, use a comma to indicate a pause.)
We will agree to the proposal if you accept our conditions.
PPaul was astonished when he heard the terms.
HHe didn’t run because he was afraid; he ran because it had started to rain.
bBut
SShe ought to be promoted, if you want my opinion.
AAt last she arrived, when the food was cold.
HHe didn’t run, because he was afraid to move.
So in the example, 'I went to bed after I had finished my housework.', the 'after-clause' tells the time of going to bed, so it is essential to the main clause.