SLING-3737 - Instance Sling Identifier may be randomly reset on restart

* add unit test to cover the use case
* read the file completely using org.apache.commons.io.FileUtils
* fix the writeSlingId method not taking the passed identifier into account