           .then (mapping) ->
             importer = new OrderStatus options
             importFn(importer, opts.status, mapping, logger)
-          .then ->
-            @_setExitCode 0
-          .fail (error) ->
-            logger.error error, 'Oops, something went wrong!'
-            logger.error error.stack if error.stack
-            @_setExitCode 1
+          .then =>
+            @_setExitCode 0
+          .fail (error) =>
+            logger.error error, 'Oops, something went wrong!'
+            logger.error error.stack if error.stack
+            @_setExitCode 1
+          .done()
 
     validateOpt = (value, varName, commandName) ->
       if not value

          .then (mapping) ->
            importer = new ProductUpdates options
            importFn(importer, opts.products, mapping, logger)
          .then ->
            @_setExitCode 0
          .fail (error) ->
            logger.error error, 'Oops, something went wrong!'
            logger.error error.stack if error.stack
            @_setExitCode 1

    program
      .command CONS.CMD_EXPORT_ORDERS

          .then (result) ->
            importer = new Products options
            importFn(importer, opts.products, mapping, logger)
          .then =>
            @_setExitCode 0
          .fail (error) =>
            logger.error error, 'Oops, something went wrong!'
            logger.error error.stack if error.stack
            @_setExitCode 1
          .done()

    program
      .command CONS.CMD_IMPORT_PRODUCTS_UPDATES
      .description 'Imports Brickfox product stock and price changes into your SPHERE.IO project.'
      .option '--products <file>', 'XML file containing products to import'
      .usage '--projectKey <project-key> --clientId <client-id> --clientSecret <client-secret> --mapping <file> --config [file] --products <file>'
      .action (opts) =>

        validateGlobalOpts(opts, CONS.CMD_IMPORT_PRODUCTS_UPDATES)
        logger = createLogger(opts)
