Dynamics of entanglement in quantum computers with imperfections