You can't. If the application is closed, the user is no longer online and the server knows that. You can still send them messages, but it is the servers job to store offline messages, but that means the server has to be configured to do so.
They can be retrieved once the user connects again.