Fixed memory leak issue

Also added optional fill color for clearFrame.