fix unlock retry logic so we actually unlock (fix #1295)
Merge pull request #1347 from jlipps/master

fix unlock retry logic so we actually unlock