I think that the termination of the subprocesses should also be called in the handleCloseEvent.