moved stop immediately condition: in any case we must clean queue and delete messages. If immediate stop is tunred on we do NOT write to file