Reds avoid being swept by Pirates, sit one game back in wild-card race