Fix handling of SIGPIPE

Fixes #41 - "SIGPIPE handling"
fixes sigpipe handling to not cause an infinite loop when a SIGPIPE occurs trying to write to stderr.