Updated File::replaceText()

1. Method now checks if the lock is not identical to null
2. Since the method uses File::read() to get the contents of the file,
there is no need for a temporary file. Removed the temporary file
creation