Add more tests and fix filtering for closed states