I think I figured it out:
$rules['closed'] didn't disable comments because its checking if the comment itself is closed. You have to check whether the parent is closed or not. So instead I added:
&& (($post['type']=='A' && !$parentpost['closed']) || ($post['type']=='Q' && !$rules['closed']));
and seemed to have worked.