We get a lot of comments from people here who've politely given their employer two weeks' notice and then get treated like absolute garbage during that period.
Please consider this your reminder that two weeks is a courtesy that can be revoked at any time.
Indeed, one of the best ways to pull a drive-by on a bad manager is to give your two weeks on Friday, then send an email to your boss' boss the following Monday evening saying “I'm sorry, but after the way X behaved today I simply cannot work for you any more, today was my last day”. Even if your plan all along was for Monday to be your last day, it's going to look like you had every intention of working two more weeks before your boss retaliated against you. And the more disruptive your departure is, the worse your boss looks, because he's the dumb asshole who couldn't be nice to you long enough for you to finish your project.
Just to be clear, I'm not saying you should lie, or pull this trick on a boss you respect. What I'm saying is that once you give notice, recess is over. The moment someone tries to fuck with you during your notice period, leave.