Fix "RuntimeError:executing in another thread" when a closed connection is used.
This bug was introduced by the previous commit.
Close #64.