Added support to flush the session after all operations