The most obvious solution is to get a workflow post-function to do it. And since post-functions that come available out of the box are very limited in their functionality, I would recommend using an addon, to expand available options. Either Scriptrunner or JMWE.
JIRA does not have a native functionality to close a sub task once the parent issue is closed.
In your case you will need an add-on to do that (like the JIRA ScriptRunner).
If your JIRA has the ScriptRunner plugin then you can have a look on how to achieve it at auto close all subtasks.
It looks like you're new here. Sign in or register to get started.