In your final year in the US you can either file a dual status return (part year resident and part year nonresident) or you can file a full year resident return and declare your worldwide income for calendar year 2018. If you earned income after leaving the US, you can use foreign tax credit to help offset any double taxation.
Filing a dual status return is a bit complicated. You can only file married filing separately and you are not allowed to use the standard deduction. You can only use itemized deductions. Please see Publication 519 page 32 for more information on dual status returns. If you choose to file a dual status return, let me know any questions that you may have. Also see page 8 for last year of residency.