Then you have to create a custom slot where you also close the second app. On how to do that, read about signals and slots in the documentation.