Thanks for your posting! It’s currently not possible to automate this directly in TestRail. This has come up before and we found that there are a few issues with this automated workflow. Often times, a test is not really ready to retest even if the linked defect or bug was fixed/closed. For example, a tester might not have access to the same build as the developers, an up-to-date test environment or something else that prevents him from verifying the test. We recommend a manual work flow and this also makes it easier to add context details for the testers such as comments or instructions from the developer who closed/fixed the issue.
I hope this helps!