You must book Magical Express in advance, but yes, you can book a one way trip back to the airport from on site.
Leaving Disney, the deadline is normally morning of the day before the day you check out.
(Going to Disney, the deadline is normally 14 days in advance to get your yellow tags on time for delivery of bags to your room, but it can be done on shorter notice for trips booked on shorter notice.)