The PID file was created at the early beginning, but wmix can abort later
if something is not ok. It is better to create it at the end, so it will
be created only if wmix will actually be running.
Took the opportunity to move the code to a dedicated function to keep main
simple, and added a check to fix possible crash on startup if environment
variable $HOME does not exist.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>