Fix use-after-free issue with pid_file in hostapd termination