subroutine flushw(ifil,kwrt,keep)
finish i/o activity for file ifil with options:
kwrt = 0 do not dump unwritten blocks to disk.
kwrt = 1 dump write blocks to disk.
kkeep = 0 release the buffer to memory pool.
kkeep = 1 retain the buffer.