Implemented socket closing when disposing main frame