Switch flush and delete worqueue

workqueue was deleted before it was flushed that caused a crash.

Signed-off-by: Eugene Krasnikov <k.eugene.e@gmail.com>