fixes #555

When a client fails to authenticate, the client is not shut down correctly and its resources (e.g. threads) are not released. Which eventually leads to an OutOfMemoryError.