Prevent error when closing last modal [story:46180163]