From the Super Mario Wiki
Seeing-eye doors are obstacles that appear in Wario Land 3. They serve to block Wario's progress, but will only close if they can see him. As such, he needs to become Invisible Wario using the potions of Mad Scienstein in order to pass. While they cannot be defeated by normal means, exiting a level with one on-screen will cause the pupil to be "defeated" with the same effect any other enemy would have.