Added topic lock
Changed shutdown process