Fix the cleanup method: issue 1566
https://github.com/WindowsAzure/azure-sdk-tools/issues/1566