I also had two classes back to back (10 minute gap) with both lectures being in buildings on opposite corners of campus. If class ended on time, it wouldn't be an issue since I can easily fast walk it in that time period. It never did though. I tried the bike route once, but it ended up taking me longer since it got really congested during that time period. If walking out was that simple I would have done it, he didn't stop you, but the professor would always assign shit or give important information out during the last couple of minutes. Plus he always did the attendance sign in sheet at the very end of class.
Normally being ~1-2 minutes late every once in a while isn't an issue, but my second professor took attendance pretty seriously. He would sit outside of class and stare at his watch, as soon as it was time, got up and closed/locked the door. If you happened to be right behind him when he was closing the door, tough luck. If you were late/absent 3 times, you were automatically dropped or if the it was past the drop period, failed. Ended up dropping my first class because of this. Despite being a pretty strict with tardiness/attendance the professor is awesome though, class became so much more enjoyable when I didn't get there huffing and puffing after running across campus and running up four flights of stairs cutting it close each time my other professor decided to end class late.