implemented basic closing and maximizing