unicode string formatting
Fix an edge case where the pidfile contains a pid for a different process
Catch IOErrors when writing the pidfile (#1017388)