Flush the stream before write call is returned.