added exception handler for BrokenPipeError