Spin valve effect in single-atom contacts