Default Freezing

Hi,

My Nexus 7 freezes when I disconnect gamepad or USB flash drive connected via OTG cable. But when I disconnect just the gamepad or USB flash driver and let OTG cable connected, it doesn´t freeze. Only when OTG cable is disconnected from Nexus 7. It is freezed for about 15 seconds and then Nexus 7 reboots itself. After reboot everything works fine.

So I want to ask what can be causing this problem?

Thank You.