Fix wrong file index when tryign to open a file

The index used belonged to the row in the client's array of files instead of
the server's.