First, always give written notice of your plans to leave.