fix bug surrounding the CLOSE msg.