use on('close') instead of on('complete')