handle SIGPIPE error so program doesnt exit