The error is raised, as the second c1_loss.backward() call would also try to calculate the gradients in enc using the already updated parameters and would thus yield this error.
Based on the code snippet it seems the second backward call is needed to calculate the gradients in dec only, which would then be updated in g_opt.step() (explained to me by @albanD  ).
If so, then you could use this neat approach:
    c1_loss.backward(inputs=list(dec.parameters()))
    g_opt.step()

which would only accumulate the gradients into the passed leaf tensors.