This can all be

    require('sdk/window/helpers').close(window).then(function() test.done())