If we want to keep the door open then keep the magnets of the same poles face to face and if to keep the door closed keep the magnets of the different poles face to face.
1 4 1
To keep it open magnet should be fixed behind the door and to keep it closed it should be places in the front part of the door
1 2 1