haproxy.py: Better error handling and code cleanups.

Changes:
* Fix the return code of the process that wasn't propagated.
* Invoke subprocesses in a simpler way.
* Properly handle cases where various commands can fail (e.g. if `pidof` doesn't exist or if `ps` fails because HAProxy goes away)
* Always explicitly close file descriptors instead of relying on Python's GC, which isn't a good practice.
* No lines longer than 80 characters.
* Use double quotes consistently.