Ending streams properly an using the node common pipe behavior