implemented door_is_closed helper function and used.