[fix] Write the buffered messages before emitting the `open` event