The Orphanage
(2007)

Short version:
Laura unknowingly killed her son.

Long version:
The children Laura played with in the beginning are the ghosts. One of the caretakers at the orphanage had a son who wore a cloth sack over his head because he was born deformed. After Laura was adopted her friends took Tomas to the cave by the beach and took his mask to see if he would come out in the daylight, but he drowned rather than show his face. His mother poisoned the 5 children and hid their bodies in the shed. She is the "social worker" who is later seen mysteriously in the shed with a shovel.

After she finds them, the other ghosts lead Laura to a hidden basement and she realizes she killed her son by accidentally trapping him while she was looking for him. She stays with him and the ghosts of the other children to take care of them.

Thanks Ria!

Zach adds...
After Laura realizes she's inadvertently killer her son, she commits suicide by overdosing on his HIV medication (which she also gives him, post-mortem). Only upon dying she is able to see the ghost children again, and further take care of them. In the final scene, her husband Carlos returns to the house to find a good luck charm he had lent Laura on the floor of the room she died in. Just then, the doors to the room open wider, and the husband smiles, sensing a sign from him deceased wife.