Bugfix: Open pidfile for writing