Just write this in the terminal:-
defaults write com.apple.finder AppleShowAllFiles FALSE and hold option while hold left click on the finder icon, it should say "relaunch finder" or after the command type KillAll Finder.... it worked for me and I have been trying to hide them the old way which was defaults write com.apple.Finder AppleShowAllFiles NO but it didnt worked. If this does not work for you. You must try few online apps that may
show hidden files.