Avoid SIGPIPE (Broken pipe errno 32) error