This bug happened to me before but now I manage to get rid of it.
I got this bug in normal game. (I don't play ranked.)
It makes you impossible to change spell, runepage or even pick a champion as the masteries tree will block the whole window.
The only thing you could do is to close the game and disconnect the internet connection.
After the above process, the coming game should be fine.
However, later I found that it is never the problem of my computer, riot's server connection or my account, due to the fact that my friends never experience the same problem when they help me to change the masteries etc.
Then I started to think what made this bug happened.
Finally I found that I was the only one who used double click to open the masteries page!
After that, I keep using single left click (I click very slow so as to avoid any accidents caused by the mouse) to open that page and up til now, this bug never happens to me anymore.
Maybe the game client allows a fast double click of the masteries icon to open the tree twice and causes the crash.
I think it makes sense to my case as I click "save masteries" would only close the 2nd tree but not the first one.
Hope this bug won't happen to anyone anymore.