Add pid option to write a pid file
minor edits to download tests