refactoring rename_pid()
- use write_pid() for checking the lock of pid file