Moves garbage collection to closecb (closes #3).
Merge branch 'issue3-memory-leak-patch'