Serial stops returning data. java.io.IOException: Device not configured in write

As is reported in the other forums about this issue, it doesn't happen with the Uno, but does happen with the Mega. The same is happening for me. I'm just curious why. I'm going to go ahead and switch back to the Uno, but I hate not knowing why just switching the boards can cause the given problem.

For the switches they register hits to boundaries. So the far left and far right switch just reverse a motor detection and therefore can be registered to the same pin. The pin detects if one of the two switches closes. Given this, does that circuit work?