Fixes issue where hiding window actually closes it.