Set isSecure back to false when closing secure connection. Fixes #2

This fixes reconnections to servers using TLS.

Note that this fix is based on v0.3.2 (since that's what we are currently using), but should be easily ported forward to v0.4.2.