BUG: fix memory leak and double execution in dot

introduced in 1.8.0dev 914294a42a
closes gh-3384
Merge pull request #3385 from juliantaylor/memleak-3384

BUG: fix memory leak and double execution in dot