Deactivate tails on close

Oops. Fix up a memory leak.