It is possible to do this yes. However, you will have a notice period in your employment contract and they could sack you during this time. You may be able to ask them to accept your resignation and allow you to leave immediately but this will be up to them as to whether they allow that or not. Of course, if they accept your immediate resignation you will only be paid up until the date it was accepted.