Localization of electrons in thin films with rough surfaces