A corporation can only be closed when the CEO of the corporation retires and none of the remaining members in the corporation can accept the CEO position, either due to not accepting new roles or not fulfilling the skill requirements of having "Corporation Management" injected, or preferably, trained to level 1.
An Alliance will be closed during the daily server maintenance downtime if the last member corporation leaves the alliance or if the monthly alliance maintenance bill is not paid on time.
Any assets remaining in possession of a corporation at the time of its closure, both in space and within corporation hangars, will be irrecoverably lost and cannot be restored by Customer Support. As such it should be double checked that no important assets remain in the corporation hangars or corporation trade orders before closing a corporation. Similarly, any sovereignty claims of an alliance that has been closed will be irrecoverably lost as well.