Fix connection and close