Fix Weird closing bug with a kind-of work around