If your I-94 is still valid for another 18 months, you can remain in the US that long.  Technically, you would be considered out of status (because you are not employed in valid H-1B status) but not unlawfully present (because you still possess a valid I-94).  This is assuming the university would not notify USCIS and revoke your H-1B approval.