added a check for connection close in the opcode