Fixed flow to avoid missing last rtmp messages from server.