[3014]Avoid NPE when closing Elexis. Better error messing for lock files
[3010]Ensure stm.delete in PersistenceObject.lock