improve modules.kmod.mod_list()

* avoid file.readlines()
* use `with` statement to ensure file gets closed
* rename `file` var to avoid unnecessary shadowing of built-in type
Merge pull request #4838 from hulu/kmod-mod_list

improve modules.kmod.mod_list()