fix matching of key lines

also remove unecessary closing of authorized_keys file,
since we are using a block and the file will be
closed automatically.