Better handling of stale socket files

Now it will check on Attach if the current socket file is stale. If so,
it will automatically remove it and create a new connection.