finish writeMessage