DDF-245: Fixed a bug where lock files would not get deleted.

Also cleaned up dead code and modified unit test to use temporary folder for folder location.