added support for pid files so detached process can be stopped