How the voltage source and resistance got shorted out by the switch?
Examine this simple circuit







simulate this circuit &ndash; Schematic created using CircuitLab

When the switch is open there is a voltage difference between point A and B and between B and C. Hence the current will flow.  







simulate this circuit

But after you closed the switch we shorted the pin B with pin C.
Shorted means that points B and C are electrically common and therefore no voltage may exist between them. The B and C becomes one point, therefore, no current can flow via R2 resistor ( all current will flow through the "short" ).