This sounds very similar to the 2002 film "They", which ends in the way you describe.

It involves a group of children who suffer from very realistic night terrors, where they are taken in the dark by creatures that have no eyes.

The end scene involves the main female character being...

>! hospitalized at a mental institution by Dr. Booth and her boyfriend Paul Loomis where she is attacked once more and transported into the separate dimension she previously saw, only this time inside of a closet. Here she screams for help towards Dr. Booth and an orderly, both of whom cannot see her. The closet door is shut by Dr. Booth and the creatures proceed to attack her.

>! [![End scene][1]][1]
>! [![Creature][2]][2]