fix flow control examples to not discard buffer when queue is full

moved the write operations outside the if in the different language examples