Unlock prefetched workunits on exit

Prefetched workunits are now unlocked on exit, which should greatly reduce the problem of having files being left in a locked state (#143).