Close 'coords_file' after writing to it

The file must be explicitly closed — otherwise, the coordinates may not be written to disk!