Fix the leaking of contexts. Closes #8