Quantum error correction and entanglement spectrum in tensor networks