Solved this problem by simply disconnecting phones after use and before 'sleeping' or turning nexus 7 off. Connect phones only after nexus 7 has booted up or woken up. It seems to me that the switch from speaker to phones is not a simple switching jack socket but the nexus senses that phones...