Yes, you can. This is precisely why it is important to make clear agreements on this when terminating employment. In many cases, it can be stipulated that you receive a neutral or positive certificate.