fixed #1464 - change so persistence dir is only backed up if node is HA ...

...master or HA disabled; handles the case of HA autodetect selecting master hence the complexity.

also fixes some leaks in test and improves atomic file update support in FileBasedObjectStore.
(incorporates new logging from #1469)
Will this not call tearDown twice? With `invocationCount > 1` then we should get tearDown after each invocation, so shouldn't need it in the finally block. Also would be nice if can rely on testng to report the exception rather than us having to explicitly log it in a catch block.