create pid file if does not exist

it now creates the pidfile if it does not exist, otherwise it opens it with r+ and reads the pid