In addition, the code over-slept between recovery attempts. The inline comment suggested that the intention was to sleep between 1 second to 1 minute, while implement an exponential sleep interval strategy. However in practice the code sleeps in intervals of 5 seconds and up to 5 minutes. So I fixed the code to sleep at interval of 5 seconds (checking if it was closed in between sleep attempts) and up to 1 minute.