Yes, you are allowed to remain in Canada so long as you continue to have a valid work permit, but you are not allowed to work for any other employer until you have secured a new work permit with different conditions.
Keep in mind that while you can travel outside the country during this time, there is a chance that an Immigration Officer may require you to surrender your work permit and may change your status to visitor if they determine that you are no longer employed.
If you are on a employer-specific work permit and have been terminated, we encourage you to contact the Toronto employment lawyers, Sultan Lawyers at 416-214-5111 or via email to khayward@sultanlawyers.com