Automatic Shutdown struggles with 4  Junit tests

Tried addressing the automatic shutdown and flush - system.exit(0).
However after 4 tests they are all accessing the file and on occasion it
fails. Would need a thread lock to stop all tests accessing and writing
to that file at once.