Fixes the Panel resize and closes it when switching projects

This is the fix for the panels that I was talking about with you in the IRC :)