No, that is not how it works.
Or at least not how it should, I don't get that can't open message, and indeed one should not get that.
I'm using ActiveState 5.8.4, but this should not make a difference as the logic is sound (and more cunning than you have so far guessed).