Created pid instance variable so value can be retained after destroy

Fixes #422