This is doing two things:

1. Setting the pid.
2. Writing it to a file.

Setting the pid can be done when Brog is created, it's a call that can't fail.  Writing to a file should be done as is done here.