Flush when closing output stream async