Read passwords from file and gracefully close a connection.