Error identities for variational problems with obstacles