It looks like this is setup to read multiple lines from the file, but it appends them to a single stream without a new line.

Are multiple lines expected to be in the pid file? If not I'd suggest throwing an error if they're found.