fix: should be defer, not go, because this should be called at the end of the rule execution
Make the rule output destinations WriteClosers and call close when done writing, to avoid keeping open so many files