added a self cleanup function to pidfile