Better handling of closing and stuff!