Flush the transfer before exiting from write function.