add queue flush before session close in case there is unsent data