When can a writ petition be filed?