Saving pid in a file