Stop the reconnect loop after five unsuccessful attempts

Also do exponential backoff instead of a fixed 1s timeout.

This closes #63