An iron nail wrapped in wire is not magnetic, but when electricity from a battery flows round and round through the coil of wire it creates a magnetic field. When the electricity stops flowing the magnetic field disappears and the nail is no longer magnetized.