I have a door going into a bunkhouse that is not visible from where the slide control switches are. On my first day of ownership, I neglected to close that door (it opens IN to the bunkhouse) Natural...
A relay is not needed. Wire the slide switch in series with a switch that is closed when the door is closed. A magnetic or limit switch will work fine.