private async void btnClose_Click(object sender, EventArgs e) { try { await StopListener(); if (parentForm != null) { ((Form)parentForm).Close(); } } catch (Exception ex) { HandleException(ex); } }