Aw that's terrible!
I'm so glad yours was found in time!
Hamsters are so curious and everything's chewable as far as they are concerned.
I frequently have panicky trips back to the flat to make sure I have locked all the cage doors before I go to work
And yes, they always are closed but I'd rather be safe than sorry.