[5.0] Only Flush The App If It Exists

If something else screwed up earlier on, we may run into a case where we hit a fatal error trying to call flush on `null`. This makes sure we don't end up with a php fatal error so people can actually work outwhat went wrong.