Update close code with “error” listener.