Added pid option

Just a simple option which writes out a pid file and removes it when it's done