fix backtrace printed when cannot get lock.
change lock error handling code so exceptions have useful info and
exception handling in one place.
add test case for when cannot get lock.
adding aadding baNONEXISTENT: No such file or directoryaba: No such file or directoryNONEXISTENT: No such file or directorybaNONEXISTENT: No such file in rev 14467d15ef43ab