Check the output buffer exists before flushing