added cleanup code for logs and runtime pids