Place log and pid file in bot directory. Move exceptions around; Fix PID writing code