a. He went out closing the door behind him.
b. He went out, closing the door behind him.
c. He shouted at her waking the children up.
d. He shouted at her, waking the children up.
Are the commas necessary?
Do they change anything in any way?
Many thanks