[AS7-6816] Make sure the ModelControllerClient is properly closed to avoid out of memory issues