Added Android + fixed bug while closing socket