Handled close, checking for connectivity.  Added JavaDoc.